Issue #84: Fixed bug in function HistoryOrderGetInteger, there was wrong return value type

This commit is contained in:
vdemydiuk
2018-02-04 14:39:09 +02:00
parent acf0c12531
commit 9581431a9f
4 changed files with 25 additions and 2 deletions
@@ -259,6 +259,7 @@
<Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/> <Button Content="HistoryDealGetDouble" Command="{Binding HistoryDealGetDoubleCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/> <Button Content="HistoryDealGetInteger" Command="{Binding HistoryDealGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/> <Button Content="HistoryDealGetString" Command="{Binding HistoryDealGetStringCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
<Button Content="HistoryOrderGetInteger" Command="{Binding HistoryOrderGetIntegerCommand}" Height="25" HorizontalAlignment="Left" Margin="4"/>
</StackPanel> </StackPanel>
</Grid> </Grid>
+12
View File
@@ -16,6 +16,7 @@ namespace MtApi5TestClient
public DelegateCommand DisconnectCommand { get; private set; } public DelegateCommand DisconnectCommand { get; private set; }
public DelegateCommand OrderSendCommand { get; private set; } public DelegateCommand OrderSendCommand { get; private set; }
public DelegateCommand HistoryOrderGetIntegerCommand { get; private set; }
public DelegateCommand HistoryDealGetDoubleCommand { get; private set; } public DelegateCommand HistoryDealGetDoubleCommand { get; private set; }
public DelegateCommand HistoryDealGetIntegerCommand { get; private set; } public DelegateCommand HistoryDealGetIntegerCommand { get; private set; }
public DelegateCommand HistoryDealGetStringCommand { get; private set; } public DelegateCommand HistoryDealGetStringCommand { get; private set; }
@@ -196,6 +197,7 @@ namespace MtApi5TestClient
DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect); DisconnectCommand = new DelegateCommand(ExecuteDisconnect, CanExecuteDisconnect);
OrderSendCommand = new DelegateCommand(ExecuteOrderSend); OrderSendCommand = new DelegateCommand(ExecuteOrderSend);
HistoryOrderGetIntegerCommand = new DelegateCommand(ExecuteHistoryOrderGetInteger);
HistoryDealGetDoubleCommand = new DelegateCommand(ExecuteHistoryDealGetDouble); HistoryDealGetDoubleCommand = new DelegateCommand(ExecuteHistoryDealGetDouble);
HistoryDealGetIntegerCommand = new DelegateCommand(ExecuteHistoryDealGetInteger); HistoryDealGetIntegerCommand = new DelegateCommand(ExecuteHistoryDealGetInteger);
HistoryDealGetStringCommand = new DelegateCommand(ExecuteHistoryDealGetString); HistoryDealGetStringCommand = new DelegateCommand(ExecuteHistoryDealGetString);
@@ -277,6 +279,16 @@ namespace MtApi5TestClient
AddLog(message); AddLog(message);
} }
private async void ExecuteHistoryOrderGetInteger(object o)
{
const ulong ticket = 12345;
const ENUM_ORDER_PROPERTY_INTEGER propertyId = ENUM_ORDER_PROPERTY_INTEGER.ORDER_POSITION_ID;
var retVal = await Execute(() => _mtApiClient.HistoryOrderGetInteger(ticket, propertyId));
AddLog($"HistoryOrderGetInteger: {retVal}");
}
private async void ExecuteHistoryDealGetDouble(object o) private async void ExecuteHistoryDealGetDouble(object o)
{ {
const ulong ticket = 12345; const ulong ticket = 12345;
BIN
View File
Binary file not shown.
+12 -2
View File
@@ -1,7 +1,7 @@
#property copyright "Vyacheslav Demidyuk" #property copyright "Vyacheslav Demidyuk"
#property link "" #property link ""
#property version "1.3" #property version "1.4"
#property description "MtApi (MT5) connection expert" #property description "MtApi (MT5) connection expert"
#include <json.mqh> #include <json.mqh>
@@ -39,6 +39,8 @@
bool getBooleanValue(int expertHandle, int paramIndex, bool& res, string& err); bool getBooleanValue(int expertHandle, int paramIndex, bool& res, string& err);
#import #import
//#define __DEBUG_LOG__
input int Port = 8228; input int Port = 8228;
int ExpertHandle; int ExpertHandle;
@@ -92,7 +94,9 @@ bool IsDemo()
bool IsTesting() bool IsTesting()
{ {
bool isTesting = MQLInfoInteger(MQL_TESTER); bool isTesting = MQLInfoInteger(MQL_TESTER);
#ifdef __DEBUG_LOG__
PrintFormat("IsTesting: %s", isTesting ? "true" : "false"); PrintFormat("IsTesting: %s", isTesting ? "true" : "false");
#endif
return isTesting; return isTesting;
} }
@@ -141,7 +145,9 @@ int init()
return (1); return (1);
} }
#ifdef __DEBUG_LOG__
PrintFormat("Expert Handle = %d", ExpertHandle); PrintFormat("Expert Handle = %d", ExpertHandle);
#endif
//--- Backtesting mode //--- Backtesting mode
if (IsTesting()) if (IsTesting())
@@ -219,10 +225,12 @@ int executeCommand()
return (0); return (0);
} }
#ifdef __DEBUG_LOG__
if (commandType > 0) if (commandType > 0)
{ {
Print("executeCommand: commnad type = ", commandType); Print("executeCommand: commnad type = ", commandType);
} }
#endif
switch (commandType) switch (commandType)
{ {
@@ -681,7 +689,9 @@ void Execute_Request()
string response = ""; string response = "";
if (request != "") if (request != "")
{ {
#ifdef __DEBUG_LOG__
Print("Execute_Request: incoming request = ", request); Print("Execute_Request: incoming request = ", request);
#endif
response = OnRequest(request); response = OnRequest(request);
} }
@@ -1151,7 +1161,7 @@ void Execute_HistoryOrderGetInteger()
return; return;
} }
if (!sendULongResponse(ExpertHandle, HistoryOrderGetInteger(ticket_number, (ENUM_ORDER_PROPERTY_INTEGER)property_id), _response_error)) if (!sendLongResponse(ExpertHandle, HistoryOrderGetInteger(ticket_number, (ENUM_ORDER_PROPERTY_INTEGER)property_id), _response_error))
{ {
PrintResponseError("HistoryOrderGetInteger", _response_error); PrintResponseError("HistoryOrderGetInteger", _response_error);
} }