mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-16 12:18:09 +00:00
Position modify
This commit is contained in:
@@ -552,6 +552,9 @@ int executeCommand()
|
||||
// case 1065: //PositionOpenWithResult
|
||||
// Execute_PositionOpen(true);
|
||||
// break;
|
||||
case 6066: //PositionModify
|
||||
Execute_PositionModify();
|
||||
break;
|
||||
case 66: //BacktestingReady
|
||||
Execute_BacktestingReady();
|
||||
break;
|
||||
@@ -3255,6 +3258,41 @@ void Execute_MarketBookRelease()
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_PositionModify()
|
||||
{
|
||||
ulong ticket;
|
||||
double sl;
|
||||
double tp;
|
||||
|
||||
if (!getULongValue(ExpertHandle, 0, ticket, _error))
|
||||
{
|
||||
PrintParamError("PositionModify", "ticket", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
if (!getDoubleValue(ExpertHandle, 1, sl, _error))
|
||||
{
|
||||
PrintParamError("PositionModify", "sl", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
if (!getDoubleValue(ExpertHandle, 2, tp, _error))
|
||||
{
|
||||
PrintParamError("PositionModify", "tp", _error);
|
||||
sendErrorResponse(ExpertHandle, -1, _error, _response_error);
|
||||
return;
|
||||
}
|
||||
|
||||
CTrade trade;
|
||||
bool ok = trade.PositionModify(ticket,sl,tp);
|
||||
Print("command PositionModify: result = ", ok);
|
||||
|
||||
if (!sendBooleanResponse(ExpertHandle, ok, _response_error))
|
||||
{
|
||||
PrintResponseError("PositionModify", _response_error);
|
||||
}
|
||||
}
|
||||
|
||||
void Execute_PositionOpen(bool isTradeResultRequired)
|
||||
{
|
||||
string symbol;
|
||||
|
||||
Reference in New Issue
Block a user