Strategy tester only works for demo account not live account?

 

Hi guys, I have the code below which I tried running in the strategy tester for both a demo account & live account with the exact same settings.

The EA works as expected in the demo account strategy tester by placing trades. However, it does not work in the live account strategy tester. GetLastError also returns "0", which I gather means the operation should have been successful.

As they both have the same settings & its run only in the strategy tester, I am stumped as to what else could be the reason. Any advice in the right direction will be greatly appreciated.

 #include<Trade\Trade.mqh>
CTrade trade;

void OnTick()
  {
      trade.Buy(1,Symbol(),NULL,NULL,NULL,NULL);
      int e = GetLastError();
      Print(e);      
  }
 

You have provided insufficient information for analysis.

Add "print" to output error information to the Experts log, and also show the output of the Strategy Tester Journal log,

Also provide technical details on your MetaTrader build and OS ... How to report technical issues?

How to report technical issues?
How to report technical issues?
  • 2023.06.20
  • www.mql5.com
To get good and efficient help you need to provide all the relevant technical informations about your context when using the application (MT5 deskt...