mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-18 21:28:10 +00:00
MtApi (MT5): Disabled backtesting in mql expert
This commit is contained in:
+22
-1
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MTApiService;
|
using MTApiService;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System.ServiceModel;
|
||||||
|
|
||||||
namespace MtApi5
|
namespace MtApi5
|
||||||
{
|
{
|
||||||
@@ -617,7 +618,11 @@ namespace MtApi5
|
|||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { indicator_handle, buffer_num, start_pos, count };
|
var commandParameters = new ArrayList { indicator_handle, buffer_num, start_pos, count };
|
||||||
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer, commandParameters);
|
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer, commandParameters);
|
||||||
|
<<<<<<< Updated upstream
|
||||||
return buffer?.Length ?? 0;
|
return buffer?.Length ?? 0;
|
||||||
|
=======
|
||||||
|
return buffer != null ? buffer.Length : 0;
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
@@ -632,7 +637,11 @@ namespace MtApi5
|
|||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { indicator_handle, buffer_num, Mt5TimeConverter.ConvertToMtTime(start_time), count };
|
var commandParameters = new ArrayList { indicator_handle, buffer_num, Mt5TimeConverter.ConvertToMtTime(start_time), count };
|
||||||
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer1, commandParameters);
|
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer1, commandParameters);
|
||||||
|
<<<<<<< Updated upstream
|
||||||
return buffer?.Length ?? 0;
|
return buffer?.Length ?? 0;
|
||||||
|
=======
|
||||||
|
return buffer != null ? buffer.Length : 0;
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
@@ -647,7 +656,11 @@ namespace MtApi5
|
|||||||
{
|
{
|
||||||
var commandParameters = new ArrayList { indicator_handle, buffer_num, Mt5TimeConverter.ConvertToMtTime(start_time), Mt5TimeConverter.ConvertToMtTime(stop_time) };
|
var commandParameters = new ArrayList { indicator_handle, buffer_num, Mt5TimeConverter.ConvertToMtTime(start_time), Mt5TimeConverter.ConvertToMtTime(stop_time) };
|
||||||
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer1, commandParameters);
|
buffer = SendCommand<double[]>(Mt5CommandType.CopyBuffer1, commandParameters);
|
||||||
|
<<<<<<< Updated upstream
|
||||||
return buffer?.Length ?? 0;
|
return buffer?.Length ?? 0;
|
||||||
|
=======
|
||||||
|
return buffer != null ? buffer.Length : 0;
|
||||||
|
>>>>>>> Stashed changes
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
@@ -1462,7 +1475,15 @@ namespace MtApi5
|
|||||||
|
|
||||||
private T SendCommand<T>(Mt5CommandType commandType, ArrayList commandParameters)
|
private T SendCommand<T>(Mt5CommandType commandType, ArrayList commandParameters)
|
||||||
{
|
{
|
||||||
var response = _client.SendCommand((int)commandType, commandParameters);
|
MtResponse response;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = _client.SendCommand((int)commandType, commandParameters);
|
||||||
|
}
|
||||||
|
catch (CommunicationException ex)
|
||||||
|
{
|
||||||
|
throw new Exception(ex.Message, ex);
|
||||||
|
}
|
||||||
|
|
||||||
if (response is MtResponseDouble)
|
if (response is MtResponseDouble)
|
||||||
return (T)Convert.ChangeType(((MtResponseDouble)response).Value, typeof(T));
|
return (T)Convert.ChangeType(((MtResponseDouble)response).Value, typeof(T));
|
||||||
|
|||||||
Binary file not shown.
+16
-13
@@ -143,21 +143,24 @@ int init()
|
|||||||
PrintFormat("Expert Handle = %d", ExpertHandle);
|
PrintFormat("Expert Handle = %d", ExpertHandle);
|
||||||
|
|
||||||
//--- Backtesting mode
|
//--- Backtesting mode
|
||||||
if (IsTesting())
|
if (false)
|
||||||
{
|
{
|
||||||
Print("Waiting on remote client...");
|
if (IsTesting())
|
||||||
//wait for command (BacktestingReady) from remote side to be ready for work
|
{
|
||||||
while(!IsRemoteReadyForTesting)
|
Print("Waiting on remote client...");
|
||||||
{
|
//wait for command (BacktestingReady) from remote side to be ready for work
|
||||||
executeCommand();
|
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.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//---
|
//---
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user