ChartOpen return value 0 in Strategy Tester

 

Good day everyone,


I'm new to MQL coding. The code below if I run in Strategy Tester, the ChartOpen returns value 0 and no new chart is open. But if I ran in live chart in demo account, new chart GBPUSD is created and the new chart ID is successfully return as non zero value.

//+------------------------------------------------------------------+
//|                                                    Hope_Test.mq5 |
//|                                                                . |
//|                                                             .com |
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   long this_chart = ChartID();
   Print("this_chart = "+IntegerToString(this_chart));
   Print("last error: "+IntegerToString(GetLastError()));
   long next_chart = ChartNext(this_chart);
   Print("next_chart = "+IntegerToString(next_chart));
   Print("chart symbol = "+ChartSymbol(this_chart));
   Print("last error: "+IntegerToString(GetLastError()));
   if(ChartSymbol(this_chart)!="GBPUSD") next_chart = ChartOpen("GBPUSD",PERIOD_H1);
   Print("next_chart = "+IntegerToString(next_chart));
   if(next_chart==0)
      Print("last error: "+IntegerToString(GetLastError()));
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+


The result when I run in Strategy Tester is attached below. The error code returns is '4103' which says cannot open file. I don't understand here. I'm opening a chart not a file.


The result when I run in live chart in demo account is attached below. Successfully opens new chart and returns non zero value for chart ID.


Can anyone please guide me what did I code wrong over here. How can I make the ChartOpen works in Strategy Tester? Any help or suggestion is kindly appreciated. Thanks everyone.