Download MetaTrader 5
To add comments, please log in or register
Register as a seller and start offering your signals!
Rinor Memeti
2659
Rinor Memeti 2014.09.30 16:53 

Hey community,

 i have a small problem during EA generating. Its about crossing.

 

For example with moving average 5 and 10:

So a buy order would be if ma 5 crosses ma 10. (ma5>ma10=Open buy order)

 BUT it also opens a buy order if the trend is running. It means that if i change for example lotsizes or something my ea opens a new order at next candle. (i had no open orders before). I have an function for "waiting till an opposite signal appears". And it works. But if i change lotsize or sl or something else, it opens a trade during the trend.

 BUT i wanna programme the EA JUST to open an order IF CROSSING. So i can change lotsizes if there is no opened trend, and dont need to be afraid that the ea opens the next trade on next candle :/

Is there somebody who knows how to code it on the above mentioned example? I tried something like ma5>ma10 AND ma5<ma10=Open buy order.

But it doesnt work :D:D hahahaha

 

Please help me. 

Alain Verleyen
Moderator
29466
Alain Verleyen 2014.09.30 17:07  
wienerschinken:

Hey community,

 i have a small problem during EA generating. Its about crossing.

 

For example with moving average 5 and 10:

So a buy order would be if ma 5 crosses ma 10. (ma5>ma10=Open buy order)

 BUT it also opens a buy order if the trend is running. It means that if i change for example lotsizes or something my ea opens a new order at next candle. (i had no open orders before). I have an function for "waiting till an opposite signal appears". And it works. But if i change lotsize or sl or something else, it opens a trade during the trend.

 BUT i wanna programme the EA JUST to open an order IF CROSSING. So i can change lotsizes if there is no opened trend, and dont need to be afraid that the ea opens the next trade on next candle :/

Is there somebody who knows how to code it on the above mentioned example? I tried something like ma5>ma10 AND ma5<ma10=Open buy order.

But it doesnt work :D:D hahahaha

 

Please help me. 

You need to check ma5 and ma10 values of 2 candles (say 1 and 2) : ma5[1]>ma10[1] and ma5[2]<ma10[2].
Rinor Memeti
2659
Rinor Memeti 2014.09.30 18:24  
angevoyageur:
You need to check ma5 and ma10 values of 2 candles (say 1 and 2) : ma5[1]>ma10[1] and ma5[2]<ma10[2].

damn it! It seems so logical :D haha. I will try it :)

many Thanks;)))

Rinor Memeti
2659
Rinor Memeti 2014.09.30 18:43  
Okay it works:) Thanks again :)
Alain Verleyen
Moderator
29466
Alain Verleyen 2014.09.30 19:05  
wienerschinken:
Okay it works:) Thanks again :)
You are welcome.
/
To add comments, please log in or register