Skip to content

Commit

Permalink
EA: Updates order stops less often as per last update param value
Browse files Browse the repository at this point in the history
  • Loading branch information
kenorb committed Sep 12, 2021
1 parent 1fc7c91 commit 7038d6a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion EA.mqh
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,9 @@ class EA {
bool _sl_valid = false, _tp_valid = false;
double _sl_new = 0, _tp_new = 0;
Order *_order = oiter.Value().Ptr();
if (_order.IsClosed()) {
if (!_order.ShouldUpdate()) {
continue;
} else if (_order.IsClosed()) {
_trade.OrderMoveToHistory(_order);
continue;
}
Expand All @@ -762,6 +764,9 @@ class EA {
}
if (_sl_valid || _tp_valid) {
_result &= _order.OrderModify(_sl_new, _tp_new);
if (_result) {
_order.Set(ORDER_PROP_TIME_LAST_UPDATE, TimeCurrent());
}
}
}
}
Expand Down

0 comments on commit 7038d6a

Please sign in to comment.