mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-18 13:18:12 +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()
|
private void OnConnected()
|
||||||
{
|
{
|
||||||
// INFO: disabled backtesting mode while solution of window handle in testing mode is not found
|
_isBacktestingMode = IsTesting();
|
||||||
//_isBacktestingMode = IsTestMode();
|
|
||||||
|
|
||||||
if (_isBacktestingMode)
|
if (_isBacktestingMode)
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
+13
-15
@@ -92,6 +92,7 @@ bool IsDemo()
|
|||||||
bool IsTesting()
|
bool IsTesting()
|
||||||
{
|
{
|
||||||
bool isTesting = MQLInfoInteger(MQL_TESTER);
|
bool isTesting = MQLInfoInteger(MQL_TESTER);
|
||||||
|
PrintFormat("IsTesting: %s", isTesting ? "true" : "false");
|
||||||
return isTesting;
|
return isTesting;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,25 +144,22 @@ int init()
|
|||||||
PrintFormat("Expert Handle = %d", ExpertHandle);
|
PrintFormat("Expert Handle = %d", ExpertHandle);
|
||||||
|
|
||||||
//--- Backtesting mode
|
//--- Backtesting mode
|
||||||
if (false)
|
if (IsTesting())
|
||||||
{
|
{
|
||||||
if (IsTesting())
|
Print("Waiting on remote client...");
|
||||||
|
//wait for command (BacktestingReady) from remote side to be ready for work
|
||||||
|
while(!IsRemoteReadyForTesting)
|
||||||
{
|
{
|
||||||
Print("Waiting on remote client...");
|
executeCommand();
|
||||||
//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.
|
//This section uses a while loop to simulate Sleep() during Backtest.
|
||||||
unsigned int viSleepUntilTick = GetTickCount() + 100; //100 milliseconds
|
unsigned int viSleepUntilTick = GetTickCount() + 100; //100 milliseconds
|
||||||
while(GetTickCount() < viSleepUntilTick)
|
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);
|
return (0);
|
||||||
|
|||||||
Reference in New Issue
Block a user