Hi, Ive made an EA that uses custom indicators and CTrade class. The problem is that the EA doesnt take all entries decpite the entry conditions being met and the entire 'trade' code block being run.
Heres the code:
I added a counter('TradesEntered' variable in code) to keep track of how much the entry conditions are true and compared that to the backtest results, Ive attached the pictures.
I'm hoping that i've overlooked something small and that the problem isn't with the CTrade class.
Thanks for taking a look.
You could debug further by having separate counters for buy and sell (BuyTradesEntered etc) and then check the backtest result. You might also consider checking the return value of the buy and sell commands, see if it returns false at any point. Also, are you seeing any trade errors in the journal file?
You could debug further by having separate counters for buy and sell (BuyTradesEntered etc) and then check the backtest result. You might also consider checking the return value of the buy and sell commands, see if it returns false at any point. Also, are you seeing any trade errors in the journal file?

- 2024.12.26
- www.mql5.com
Print(market.ResultRetcodeDescription());

- 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, Ive made an EA that uses custom indicators and CTrade class. The problem is that the EA doesnt take all entries decpite the entry conditions being met and the entire 'trade' code block being run.
Heres the code:
I added a counter('TradesEntered' variable in code) to keep track of how much the entry conditions are true and compared that to the backtest results, Ive attached the pictures.
I'm hoping that i've overlooked something small and that the problem isn't with the CTrade class.
Thanks for taking a look.