-
if(Volume[0] > 1) return(0);
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06 -
if(((EMARed1 && EMAYellow1 && EMAOliveDrab1) < (SMAYellow1)
That will never do what you want. True = non-zero and false = zero so you get:if( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true )
if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false )
-
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart,) volume is unreliable (miss ticks,) Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
New candle - MQL4 programming forum #3 2014.04.04I disagree with making a new bar function, because it can only be called once per tick. A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum 2011.05.06 - That will never do what you want. True = non-zero and false = zero so you get:
So what could I do to make it do exactly what I want: that when the emas (it does not matter the order which first crosses) crosses the sma, an operation opens. excuse me i'm new to mql4
So code that. (There are at least two different ways.)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi, i'm having a problem with my ea. the point of the strategy is that when the ema of 9, the ema of 8 and the ema of 13 periods cross the sma of 20 there will be an operation (only one at a time) but when compiling it does not give me errors but in strategy tester does not open operations does nothing. If someone can help me detect what is missing or what is the error, it would be very helpful