MtApi5: add waiting incoming connection on MT5 side in backtesting mode

This commit is contained in:
DW
2017-11-15 18:16:23 +02:00
parent 9587b10c8c
commit b8314e9ed7
3 changed files with 15 additions and 18 deletions
+1 -2
View File
@@ -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)
{
BIN
View File
Binary file not shown.
+14 -16
View File
@@ -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);