mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-07-28 02:57:56 +00:00
MtApi5: add waiting incoming connection on MT5 side in backtesting mode
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Binary file not shown.
+14
-16
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user