BackTesting failed || MT4

 

I am trying to implement a strategy on my Demo Bybit account for a crypto pair. I am not able to back test it as it gets stuck after 1st order.

I have attached a screenshot also of the settings that I use while running the Strategy tester.

Log File:

==================================================================================================================================

0 21:31:01.415 Expert ETH_SMA ETHUSDT,H4: loaded successfully

0 21:31:01.566 TestGenerator: current spread 540 used

3 21:31:18.205 Tester: exchange rate cannot be calculated

3 21:31:18.205 Tester: margin exchange rate cannot be calculated

2 21:31:18.206 2022.01.01 00:00:00  ETH_SMA test started

2 21:32:03.732 2022.02.09 04:00:00  ETH_SMA ETHUSDT,H4: open #1 buy 1.00 ETHUSDT at 3078.30 sl: 2985.95 tp: 3509.26 ok

1 21:32:03.732 2022.02.09 04:00:01  ETH_SMA: tester cannot calculate prices

2 21:32:03.732 2022.02.09 04:00:01  Tester: order #1 is closed

0 21:32:03.732 ETHUSDT,H4: 3892238 tick events (286 bars, 15406602 bar states) processed in 0:00:45.516 (total time 0:01:02.266)

==================================================================================================================================

My Code:

//+------------------------------------------------------------------+
//|                                                      ETH_SMA.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int order;
void OnTick()
  {
//---
   double sma_60 =  NormalizeDouble(iMA(NULL,0,60,0,MODE_SMA,PRICE_CLOSE,0),2);
   double sma_100 = NormalizeDouble(iMA(NULL,0,100,0,MODE_SMA,PRICE_CLOSE,0),2);
   double sma_200 = NormalizeDouble(iMA(NULL,0,200,0,MODE_SMA,PRICE_CLOSE,0),2);
   
   double rsi= NormalizeDouble(iRSI(NULL,0,14,PRICE_CLOSE,0),2);


   //Alert(current_bid);
   
   
   if ((sma_60 > sma_100) && (sma_100 > sma_200))
      {
         if (rsi > 51)
            {
                {
                     RefreshRates();
                     double current_price = SymbolInfoDouble(Symbol(),SYMBOL_ASK);
                     double stopLoss = NormalizeDouble(current_price - (current_price * 0.03),2);    //3% StopLoss
                     double takeProfit = NormalizeDouble(current_price + (current_price * 0.14),2); //14% TakeProfit
                     order=OrderSend(Symbol(),OP_BUY,1,current_price,0,stopLoss,takeProfit);
                     //printf(GetLastError());
                     
                }
            }
      } 
   
  }
Files:
ETH_SMA.JPG  60 kb
 

Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
          General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon.