Miscellaneous
It issuies visual alerts to the screenIt opens Message Boxes to the user
0 Views
0 Downloads
0 Favorites
Validate
ÿþ#property description "Original Filename: " + __FILE__

#property description "Compile Time: " + (string)__DATETIME__

#ifdef _RELEASE

  #property description "Compiler Version: " + (string)__MQLBUILD__ + " " + __CPU_ARCHITECTURE__ + " Release."

#else // #ifdef _RELEASE

  #property description "Compiler Version: " + (string)__MQLBUILD__ + " " + __CPU_ARCHITECTURE__ + " Debug."

#endif // #ifdef _RELEASE #else

#property link "https://www.mql5.com/ru/blogs/post/733182"



#define FAKE // #1@0BL - >1E>4 4;O @07<5I5=8O :>40 2 .



#ifdef FAKE

  int OnInit() { TesterWithdrawal(1); return(INIT_SUCCEEDED); }

#else // FAKE



#include <fxsaber\HistoryTicks\ArrayResize.mqh> // https://www.mql5.com/ru/forum/233647/page2#comment_9831230



/*

#ifdef _RELEASE

  input group "This is Release-version. Please recompile to Debug-version!"

#endif // #ifdef _RELEASE

*/

sinput uint inInSampleDays = 28;     // InSampleDays

sinput uint inOutSampleDays = 14;    // OutSampleDays

sinput bool inWithHolidays = true;   // With Holidays



// https://www.mql5.com/ru/forum/170952/page159#comment_14726390

//input string inFolderName = "ValidateTasks";      // FolderName (Empty - Create Tasks)

input string inFolderName = "";      // FolderName (Empty - Create Tasks)

input string inOutSampleSymbol = ""; // OutSampleSymbol (Empty - not change)



input int inMaxPasses = 0;



input string inConstParameters = NULL;



#define REPORT_BROWSER            // !>740=85 >BG5B0 A 70?CA:>< 1@0C75@0 - B@51C5B @07@5H5=8O DLL.

#define REPORT_TESTER             //  B5AB5@5 1C4CB 02B><0B8G5A:8 70?8AK20BLAO >BG5BK

#define REPORT_TESTER_INPUTS      //  >BG5B5 >48=>G=>3> ?@>E>40 1C4CB 284=K 2E>4=K5 ?0@0<5B@K A>25B=8:0 - B@51C5B @07@5H5=8O DLL.

#define REPORT_INTERACTIVE_CHARTS // >102;O5B 2 >BG5B 8=B5@0:B82=K5 3@0D8:8.

#include <Report.mqh> // https://www.mql5.com/ru/code/16006



#include <fxsaber\Validate\ValidateTasks.mqh>

#include <fxsaber\Validate\Validate.mqh>



VALIDATE* Validate = NULL;



int OnInit()

{

  if (MQLInfoInteger(MQL_OPTIMIZATION))

    return(INIT_FAILED);



  if ((inOutSampleSymbol != "") && !SymbolInfoInteger(inOutSampleSymbol, SYMBOL_SELECT))

  {

    ::Alert("The symbol " + inOutSampleSymbol + " is not found.");



    return(INIT_FAILED);

  }



  const string FolderName = ((inFolderName == "") && !MQLInfoInteger(MQL_TESTER)) ?

                            VALIDATETASKS::Create(inInSampleDays, inOutSampleDays, __FILE__, inWithHolidays) :

                            (inFolderName + (!StringLen(inFolderName) || (inFolderName[StringLen(inFolderName) - 1] != '\\') ? "\\" : NULL));

  const bool Res = (FolderName != NULL) && EventSetTimer(1);



  if (Res)

  {

/*

    if (!MQLInfoInteger(MQL_TESTER))

    {

      Print(ChartSetInteger(0, CHART_SHOW, false));

      Print(ChartSetInteger(0, CHART_IS_DOCKED, false));

    }

*/

    Validate = new VALIDATE(FolderName, inOutSampleSymbol, inMaxPasses, inConstParameters);



    OnTimer();

  }



  return(Res ? INIT_SUCCEEDED : INIT_FAILED);

}



void OnDeinit( const int Reason )

{

  if (Validate != NULL)

    delete Validate;



  // https://www.mql5.com/ru/forum/170952/page169#comment_15531309

  if (Reason == REASON_CLOSE)

    MessageBox("Terminal is being closed!");

}



void OnTimer()

{

  if (Validate != NULL)

  {

    if (Validate.IsFinish())

      ExpertRemove();

    else

      Validate.OnTimer();

  }

}



void OnTick()

{

  if (Validate != NULL)

    Validate.OnTick();

}



void OnChartEvent( const int id, const long &lparam, const double &dparam, const string &sparam )

{

  if (Validate != NULL)

    Validate.OnChartEvent(id, lparam, dparam, sparam);

}



#endif // FAKE

Comments