Issue #119: Added out parameter MqlTradeResult to function PositionClose

This commit is contained in:
vdemydiuk
2018-06-04 17:48:14 +03:00
parent 5d78ad5067
commit 0f717f1cb7
9 changed files with 144 additions and 12 deletions
+22
View File
@@ -66,6 +66,7 @@ namespace MtApi5TestClient
public DelegateCommand MarketBookGetCommand { get; private set; }
public DelegateCommand PositionOpenCommand { get; private set; }
public DelegateCommand PositionCloseCommand { get; private set; }
public DelegateCommand GetLastErrorCommand { get; private set; }
public DelegateCommand ResetLastErrorCommand { get; private set; }
@@ -263,6 +264,17 @@ namespace MtApi5TestClient
OnPropertyChanged("GlobalVarValue");
}
}
private ulong _positionTicketValue;
public ulong PositionTicketValue
{
get { return _positionTicketValue; }
set
{
_positionTicketValue = value;
OnPropertyChanged("PositionTicketValue");
}
}
#endregion
#region Public Methods
@@ -358,6 +370,7 @@ namespace MtApi5TestClient
MarketBookGetCommand = new DelegateCommand(ExecuteMarketBookGet);
PositionOpenCommand = new DelegateCommand(ExecutePositionOpen);
PositionCloseCommand = new DelegateCommand(ExecutePositionClose);
PrintCommand = new DelegateCommand(ExecutePrint);
AlertCommand = new DelegateCommand(ExecuteAlert);
@@ -1098,6 +1111,15 @@ namespace MtApi5TestClient
AddLog($"PositionOpen: symbol EURUSD retVal = {retVal}, result = {tradeResult}");
}
private async void ExecutePositionClose(object obj)
{
var ticket = PositionTicketValue;
MqlTradeResult tradeResult = null;
var retVal = await Execute(() => _mtApiClient.PositionClose(ticket, out tradeResult));
AddLog($"PositionClose: ticket {ticket} retVal = {retVal}, result = {tradeResult}");
}
private async void ExecutePrint(object obj)
{
var message = MessageText;