EA not opening sell orders in strategy tester

 

Hello, I have a custom EA that works fine in the live market, but when doing a back test in the strategy tester, it does not open sell orders. There are no errors or warnings; it just doesn't open sell orders. I've checked every possible reason that might be the reason why it does not open sell orders, but I can't find anything, especially since it works fine in the real market and it opens both buys and sells. I've checked my PC, strategy tester settings being used, and everything is normal. I'm really stumped as to why it's doing this, as it shouldn't. Has anyone experienced this before? If so, any ideas or suggestions on how to solve it? Thank you. 

 
It's common that errors like this occur when you set a wrong currency when testing in the backtest. If your currency is in USD, set it to USD. Just for instance, I did a test and changed my strategy tester currency (changed it from USD to EUR) and even when I set it back to USD, my strategy tester stopped working correctly and only came back when I restarted the terminal.
 
Emanuel Cavalcante Amorim Filho #:
It's common that errors like this occur when you set a wrong currency when testing in the backtest. If your currency is in USD, set it to USD. Just for instance, I did a test and changed my strategy tester currency (changed it from USD to EUR) and even when I set it back to USD, my strategy tester stopped working correctly and only came back when I restarted the terminal.

Thanks for your reply.

I am testing in the base currency so there is no issue from that.

I've looked at every part of the code where OP_SELL is used and can't fund anything that would stop a sell order from opening in strategy tester, expecially since it operates fine in live trading.

 

Does any one have any ideas as to why this is happening?

I'm really stumped here and can't find anything that would prevent sell orders from opening in strategy tester.

 
pipchaser88 #:

Does any one have any ideas as to why this is happening?

I'm really stumped here and can't find anything that would prevent sell orders from opening in strategy tester.

Did you check that the Expert Properties are set to open in both direction ?


 
Also, either share some code so we can reproduce the error (if you don't want to share your EA's code, just create a simple test one that also don't open short positions and share it with us) or debug your code by setting some breakpoints around the code that should be sending sell orders. If the breakpoints are never triggered, for sure there's some part of your code that is stopping the EA from sending sell orders.
 

Hi

It might be also the EA issue – do you have the code? Maybe there is something coded in the EA that blocks sell trades? Or there might be any conditions that are read from live markets only.

In mt4 you can also specify in general inputs which direction is allowed only (so you might set only Long or only short – and only those trades would be opened then). You can check if yo didn’t choose such option.

Best Regards

 
Alain Verleyen #:

Did you check that the Expert Properties are set to open in both direction ?


Yes that was one of the first things I checked. I'm not a beginner coder and I have checked everything I can think of that might be the casue of this.
 
Emanuel Cavalcante Amorim Filho #:
Also, either share some code so we can reproduce the error (if you don't want to share your EA's code, just create a simple test one that also don't open short positions and share it with us) or debug your code by setting some breakpoints around the code that should be sending sell orders. If the breakpoints are never triggered, for sure there's some part of your code that is stopping the EA from sending sell orders.

I can't share the source code as its a project that once completed I will maybe put on the market.

I did put prints statements to try find where the problem might be but nothing came up, everything was fine.

There is no issue in live market trading, it trades fine opening both buy and sell orders, its only happening in strategy tester so running any back tests is inaccurate.

Reason: