From 88420bfeda96a0daa5f9fc1972ceedc571957ea7 Mon Sep 17 00:00:00 2001 From: kenorb Date: Fri, 21 Jul 2023 21:08:33 +0100 Subject: [PATCH] Order: Fixes the current volume value when data in orequest is missing --- Order.mqh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Order.mqh b/Order.mqh index 7baf70a22..84ee72e20 100644 --- a/Order.mqh +++ b/Order.mqh @@ -934,7 +934,7 @@ class Order : public SymbolInfo { _request.type_filling = GetOrderFilling(odata.Get(ORDER_SYMBOL)); _request.position = oresult.deal; _request.price = SymbolInfo::GetCloseOffer(odata.Get(ORDER_TYPE)); - _request.volume = orequest.volume; + _request.volume = odata.Get(ORDER_VOLUME_CURRENT); Order::OrderSend(_request, oresult, oresult_check); switch (oresult.retcode) { case TRADE_RETCODE_DONE: @@ -1589,6 +1589,7 @@ class Order : public SymbolInfo { #endif // Update double values. _result &= Refresh(ORDER_PRICE_OPEN); + _result &= Refresh(ORDER_VOLUME_INITIAL); // Update string values. _result &= Refresh(ORDER_SYMBOL); _result &= Refresh(ORDER_COMMENT); @@ -1600,9 +1601,6 @@ class Order : public SymbolInfo { // _result &= Refresh(ORDER_STATE); // @fixme: Error 69539 // _result &= Refresh(ORDER_TYPE_TIME); // @fixme: Error 69539 // _result &= Refresh(ORDER_TYPE_FILLING); // @fixme: Error 69539 - // Update double values. - // _result &= Refresh(ORDER_VOLUME_INITIAL); // @fixme: false - // _result &= Refresh(ORDER_VOLUME_CURRENT); // @fixme: Error 69539 } // Updates whether order is open or closed. @@ -1616,6 +1614,7 @@ class Order : public SymbolInfo { _result &= Refresh(ORDER_PRICE_CURRENT); _result &= Refresh(ORDER_SL); _result &= Refresh(ORDER_TP); + _result &= Refresh(ORDER_VOLUME_CURRENT); } //} else if (IsPending()) // _result &= Refresh(ORDER_PRICE_STOPLIMIT); // @fixme: Error 69539 @@ -1803,6 +1802,9 @@ class Order : public SymbolInfo { case ORDER_VOLUME_CURRENT: _result = Order::OrderGetDouble(ORDER_VOLUME_CURRENT, _value); break; + case ORDER_VOLUME_INITIAL: + _result = Order::OrderGetDouble(ORDER_VOLUME_INITIAL, _value); + break; default: return false; } @@ -2144,10 +2146,10 @@ class Order : public SymbolInfo { #endif switch (property_id) { case ORDER_VOLUME_INITIAL: - _result = ::OrderLots(); // @fixit Are we sure? + _result = ::OrderLots(); break; case ORDER_VOLUME_CURRENT: - _result = ::OrderLots(); // @fixit Are we sure? + _result = ::OrderLots(); break; case ORDER_PRICE_OPEN: _result = ::OrderOpenPrice(); @@ -2551,9 +2553,7 @@ class Order : public SymbolInfo { case ORDER_VOLUME_INITIAL: return OrderGetValue(POSITION_VOLUME, _type, _out); case ORDER_VOLUME_CURRENT: - // @fixme - SetUserError(ERR_INVALID_PARAMETER); - return NULL; + return OrderGetValue(POSITION_VOLUME, _type, _out); case ORDER_PRICE_OPEN: return OrderGetValue(POSITION_PRICE_OPEN, _type, _out); case ORDER_SL: