diff --git a/MtApi5/MtApi5Client.cs b/MtApi5/MtApi5Client.cs index edb1b316..bafe7d85 100755 --- a/MtApi5/MtApi5Client.cs +++ b/MtApi5/MtApi5Client.cs @@ -1888,8 +1888,7 @@ namespace MtApi5 private void OnConnected() { - // INFO: disabled backtesting mode while solution of window handle in testing mode is not found - //_isBacktestingMode = IsTestMode(); + _isBacktestingMode = IsTesting(); if (_isBacktestingMode) { diff --git a/mq5/MtApi5.ex5 b/mq5/MtApi5.ex5 index dfaf7b15..468ee90b 100755 Binary files a/mq5/MtApi5.ex5 and b/mq5/MtApi5.ex5 differ diff --git a/mq5/MtApi5.mq5 b/mq5/MtApi5.mq5 index 7eaeb7da..ed23d8a9 100755 --- a/mq5/MtApi5.mq5 +++ b/mq5/MtApi5.mq5 @@ -92,6 +92,7 @@ bool IsDemo() bool IsTesting() { bool isTesting = MQLInfoInteger(MQL_TESTER); + PrintFormat("IsTesting: %s", isTesting ? "true" : "false"); return isTesting; } @@ -143,25 +144,22 @@ int init() PrintFormat("Expert Handle = %d", ExpertHandle); //--- Backtesting mode - if (false) - { - if (IsTesting()) - { - Print("Waiting on remote client..."); - //wait for command (BacktestingReady) from remote side to be ready for work - while(!IsRemoteReadyForTesting) + if (IsTesting()) + { + Print("Waiting on remote client..."); + //wait for command (BacktestingReady) from remote side to be ready for work + while(!IsRemoteReadyForTesting) + { + executeCommand(); + + //This section uses a while loop to simulate Sleep() during Backtest. + unsigned int viSleepUntilTick = GetTickCount() + 100; //100 milliseconds + while(GetTickCount() < viSleepUntilTick) { - executeCommand(); - - //This section uses a while loop to simulate Sleep() during Backtest. - unsigned int viSleepUntilTick = GetTickCount() + 100; //100 milliseconds - while(GetTickCount() < viSleepUntilTick) - { - //Do absolutely nothing. Just loop until the desired tick is reached. - } + //Do absolutely nothing. Just loop until the desired tick is reached. } } - } + } //--- return (0);