Skip to content

Commit

Permalink
Order: Fixes the current volume value when data in orequest is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Jul 21, 2023
1 parent 1e585d8 commit 88420bf
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Order.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -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<ENUM_ORDER_TYPE>(ORDER_TYPE));
_request.volume = orequest.volume;
_request.volume = odata.Get<double>(ORDER_VOLUME_CURRENT);
Order::OrderSend(_request, oresult, oresult_check);
switch (oresult.retcode) {
case TRADE_RETCODE_DONE:
Expand Down Expand Up @@ -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);
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 88420bf

Please sign in to comment.