diff --git a/Order.mqh b/Order.mqh index 45599668f..80154378b 100644 --- a/Order.mqh +++ b/Order.mqh @@ -932,8 +932,7 @@ class Order : public SymbolInfo { _request.symbol = odata.Get(ORDER_SYMBOL); _request.type = NegateOrderType(odata.Get(ORDER_TYPE)); _request.type_filling = GetOrderFilling(odata.Get(ORDER_SYMBOL)); - _request.position = - odata.Get(ORDER_POSITION_ID) > 0 ? odata.Get(ORDER_POSITION_ID) : odata.Get(ORDER_TICKET); + _request.position = odata.Get(ORDER_PROP_TICKET); _request.price = SymbolInfo::GetCloseOffer(odata.Get(ORDER_TYPE)); _request.volume = odata.Get(ORDER_VOLUME_CURRENT); Order::OrderSend(_request, oresult, oresult_check); diff --git a/Order.struct.h b/Order.struct.h index 9e4cb4d99..d295b370f 100644 --- a/Order.struct.h +++ b/Order.struct.h @@ -383,6 +383,7 @@ struct OrderData { return (T)type_time; case ORDER_MAGIC: return (T)magic; +#ifndef __MQL4__ case ORDER_POSITION_ID: return (T)position_id; case ORDER_POSITION_BY_ID: @@ -391,6 +392,7 @@ struct OrderData { return (T)reason; case ORDER_TICKET: return (T)ticket; +#endif } SetUserError(ERR_INVALID_PARAMETER); return WRONG_VALUE; @@ -500,7 +502,9 @@ struct OrderData { return "???"; } // Setters. - void IncCloseTries() { close_tries++; } + void IncCloseTries() { + close_tries++; + } template void Set(ENUM_ORDER_PROPERTY_CUSTOM _prop_name, T _value) { switch (_prop_name) { @@ -609,6 +613,7 @@ struct OrderData { case ORDER_MAGIC: magic = _value; return; +#ifndef __MQL4__ case ORDER_POSITION_ID: position_id = _value; return; @@ -621,6 +626,7 @@ struct OrderData { case ORDER_TICKET: ticket = _value; return; +#endif } SetUserError(ERR_INVALID_PARAMETER); }