Can someone please explain this code? And is it neccessary for tickdata backtesting?

Back to topics list To post a new topic, please log in or register
avatar
37
waterhorse 2015.01.29 16:47
 

 #include <CustomChartingBacktest.mqh>

and at the very top of the void OnTick() function add the following function call:

if(skipFirstTickOnBacktest()) return;

 

//+------------------------------------------------------------------+
//|                                       CustomChartingBacktest.mqh |
//|                                        Copyright 2012, AZ-INVEST |
//|                                          http://www.az-invest.eu |
//+------------------------------------------------------------------+
#property copyright "Copyright 2012, AZ-INVEST"
#property link      "http://www.az-invest.eu"

bool skipFirstTickOnBacktest()
{
   if(!IsTesting())
      return(false);
      
   static datetime lastbar;
   RefreshRates();
   datetime curbar = Time[0];
   if(lastbar!=curbar)
   {
      lastbar=curbar;
      return (true);
   }
   else
   {
      return(false);
   }   
}

 

Back to topics list  

To add comments, please log in or register