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].
damn it! It seems so logical :D haha. I will try it :)
many Thanks;)))
Okay it works:) Thanks again :)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
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.