molanis.com/forum - Tools for MetaTrader : The place to ask about the best expert advisor builder, expert advisor downloads, and expert advisor programming

AFTER YOU REGISTER SEND US AN EMAIL TO ACTIVATE YOUR ACCOUNT - Before posting:-1- Please read the user guide -2- Try the examples -3- Search in the forum
It is currently Sun Jun 02, 2024 5:45 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: ea with he same lowest close
PostPosted: Thu Apr 19, 2012 2:37 pm 
Offline

Joined: Thu Apr 19, 2012 2:17 pm
Posts: 15
Hi all
I made an two simple indicators ... close(i) .. with advance formula lowest advanced period 5 .. and another one with 30 ...

The indicators work well and display well in the chart window

Strategy: sell if both indicators are the same ... close the trade if they are not the same ..

I did the ea for it and tried ... started with if the custom indicators are equall = ... then i tried ... > and < ... both does not work.

If i open the metratrader 4 it sells right away even if the indicator lines show a different value

any suggetion ... solution?


Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Mon Apr 23, 2012 9:06 am 
Offline
Site Admin

Joined: Fri Oct 16, 2009 3:40 pm
Posts: 451
Probably your trading conditions are not correct so the ea for mt4 does not work as desired. Post your strategy file .mol file and the custom indicator for us to take a look
Also, check this:
viewtopic.php?f=3&t=1329


Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Tue Apr 24, 2012 12:55 pm 
Offline

Joined: Thu Apr 19, 2012 2:17 pm
Posts: 15
Thanks for looking at it


Attachments:
openhighest30.moi [1.45 KiB]
Downloaded 493 times
openhighest5.moi [1.45 KiB]
Downloaded 435 times
test highestopen2.mol [10.03 KiB]
Downloaded 497 times
Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Tue Apr 24, 2012 12:56 pm 
Offline

Joined: Thu Apr 19, 2012 2:17 pm
Posts: 15
one cust indicator was missing


Attachments:
openhighest50.moi [1.46 KiB]
Downloaded 455 times
Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Tue Apr 24, 2012 4:36 pm 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Please describe the strategy (buy when indicator x do this with signal a.. etc)


Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Wed Apr 25, 2012 5:14 am 
Offline

Joined: Thu Apr 19, 2012 2:17 pm
Posts: 15
I included the origonal strategy .. with condition equal ...

Strategy:
Buy if the three custome indicators are the same
Close the buy if costume indicator openhighest5 is lower than custom indicator openhighest30

..after loading the custom indicator we see once they are the same on the chart ( in reality they are not the same as I learned ) and move up together ( buy order ) ... the same counts for highestclose as described in the first description ( sell order ) ..

is there a way to do this strategy with molanis ?
Can the highestopen of x bars be variable for optimizations of the ea once it works ?

thanks


Attachments:
origionalopenhighest.mol [10.01 KiB]
Downloaded 442 times
Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Wed Apr 25, 2012 8:49 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
When trading in mt4 you need to define better trading conditions:
Quote:
Buy if the three custome indicators are the same

This one does not make sense. Put all indicators in the chart and think how you want it.
Also, define independent conditions. The highest high of the last 30 bars could include the highest high of the last 5 bars if the highest take place in any of the last 5 bars.
Do you want to compare the highest of the last 5 bars, with the highest of the 30 bars before the last 5 bars? maybe using i+6 may help...
it's really difficult to understand your logic. Probably you saw something like the ma of the last 5 bars > ma of the last 30 bars then BUY, which is ok, but you cannot do the same thing with "the highest"

Quote:
Close the buy if costume indicator openhighest5 is lower than custom indicator openhighest30

This may work if you shift the calculation for openhighest30 to start on i+6


Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Wed Apr 25, 2012 8:57 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
On the other hand if you define highest of las 5, and highest of last 30 you could use equal to trade. That would mean that you Buy if the highest of the last 5 bars is also the highest of the last 30. I told you before that you need a fixed level to trade using equal - int his case I think the highest can be used as a fixed level. I hope I am not confussing you
Just a reminder, to backtest it in mt4, you need to use the same timeframe and pair for all indicators.
Also, if you use open for the calculation (I would use close), you cannot check the chart because the chart plots the close, so you may think the chart is right and the ea is wrong, in reality both are right but show different things.


Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Wed Apr 25, 2012 12:19 pm 
Offline

Joined: Thu Apr 19, 2012 2:17 pm
Posts: 15
see chart .. pdf file .. for me it makes sense ...to test the strategy


Attachments:
highest open explanation.pdf [125.42 KiB]
Downloaded 577 times
Top
 Profile  
 
 Post subject: Re: ea with he same lowest close
PostPosted: Thu Apr 26, 2012 10:08 am 
Offline

Joined: Tue Dec 22, 2009 12:22 am
Posts: 1761
Maybe I did not explain myself. The startegy idea is good, the definition of the trading conditions does not make sense.
You need to define "approximate" - all signals have to be close. At the end of the that you need to put it down in a formula.
Maybe using this: (just an idea)
MathAbs(signal 1 - signal 2)< n , n is given in pips. With this definition you can say if the difference between the 2 signals is lower than n pips then BUY
To implement the ea:
-Create a new indicator with MathAbs(signal 1 - signal 2), import it into the ea builder and compare it to a number (in a TA+). 1 pip for EURUSD = 0.0001
-The second option is to use your existing indicators and in the mql icon create MathAbs(signal 1 - signal 2)< n
After you know it works fine, add a second condition for MathAbs(signal 2- signal 3)> n.
I hope this ideas help you to build your expert advisor.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by Molanis © 2009