Not too sure why you get that 1st random entry, but the multiple entries later on are because you are looking at the iMA of the current bar, which will be changing all the time. So I'd replace
fastEma = iMA(NULL,0,FastEmaPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
slowEma = iMA(NULL,0,SlowEmaPeriod, 0, MODE_EMA, PRICE_CLOSE, 0);
with
fastEma = iMA(NULL,0,FastEmaPeriod, 0, MODE_EMA, PRICE_CLOSE, 1);
slowEma = iMA(NULL,0,SlowEmaPeriod, 0, MODE_EMA, PRICE_CLOSE, 1);
BB
uuh of course! Thats so simple, it's actually quite beautiful
Thanks,
georg

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hey Forum!
I was a passive reader up to now, but when starting to code on your own, you get your very own questions
I did a few testings with custom indicators and they worked pretty fine - i at least have the basics now.
But when trying to get the knack on the expert advisor i seemed to have some failures i cant figure out.
The EA simply looks for EMAs crossing and then gives a trade signal - as stated above that is for testing purpose only
But when backtesting this with MT, i get trades placed on the most weird places as you can see in the attached image.
I played around with the stuff but i simply cant find the reason why he places the trade in the middle of nowhere and i have no idea whatsoever how to effective debug that code
I hope some of you can help me there
thanks,
georg