MQL5 Backtest a custom symbol. Market close error

 

Hello to everybody! :)

I'm trying to pass my EA from mt4 to mt5 but I'm having problem with backtasting the code..

I've tickhistory, I've downloded the full histoy of EURUSD pair, I've create a custom symbol named EURUSD_tickhistory coping from the orginal EURUSD symbol and then imported all the ticks exported from tickhistoy...

If I backtest with the example ea "MACD Sample.ex5" just for testing and it works without problems


 


When I try to test my code It shows this error:

"failed market sell 0.01 EURUSD_tickhistory tp: 1.23361 [Market closed]"

And no trade were opened

//+------------------------------------------------------------------+
//|                                                      PerTest.mq5 |
//|                        Copyright 2020, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

   //--- dichiaro ed inizializzo la richiesta di trade ed il risultato della richiesta di trade
   MqlTradeRequest request={0};
   MqlTradeResult  result={0};    
   //--- parametri della richiesta
      request.action   =TRADE_ACTION_DEAL;                              // tipo di operazione di trade
      request.symbol   =Symbol();                                       // simbolo
      request.volume   =0.01;                                           // volume di 0.1 lotti
      request.type     =ORDER_TYPE_SELL;                                // tipo di ordine
      request.tp       =(SymbolInfoDouble(Symbol(),SYMBOL_BID)-0.00300);// takeprofit dell'ordine
      request.comment  ="I'm a comment";                                // commento dell'ordine
      request.price    =SymbolInfoDouble(Symbol(),SYMBOL_BID);          // prezzo per l'apertura
      request.deviation=10;                                             // permessa la deviazione dal prezzo
      request.magic    =223489;                                         // MagicNumber dell'ordine
      request.type_filling   = SYMBOL_FILLING_FOK;                      // Order execution type
   //--- invio la richiesta
   if(!OrderSend(request,result))
   PrintFormat("OrderSend error %d",GetLastError());           // se impossibilitato ad inviare la richiesta, da in output il codice d'errore
      
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Trade function                                                   |
//+------------------------------------------------------------------+
void OnTrade()
  {
//---
   
  }
//+------------------------------------------------------------------+



Can some one help me?

How can I open an order in a custom symbol on mt5?


Thaks a lot to everyones


Have a good day

 
If I try to backtest the same code on EURUSD pair (downloding form server the data) it works (but with 9% of model quality), so I think is an error while i was creatind the custom symobol or I have to add something in teh code.. Any suggestion?