int total = OrdersTotal();
for (int i = 0; i < total; i++)
{
OrderSelect(i, SELECT_BY_POS);
if (OrderClosePrice() <= OrderStopLoss() + 0.0005)
{
OrderModify( OrderTicket(), NULL, Ask - 40 * Point, OrderTakeProfit(), 0, Aqua);
}
}
What were doing here is modifying the stop loss if the close price of a particular order falls to 5 pips above the stop loss. My Question is what if the close price of this order falls beyond the stop loss level completely, thereby closing the order; will this code still be executed?
Basically what I'm doing is modifying the stop loss level so that the order doesn't close if the price falls, so that were still in the trade.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
int total = OrdersTotal();
for (int i = 0; i < total; i++)
{
OrderSelect(i, SELECT_BY_POS);
if (OrderClosePrice() <= OrderStopLoss() + 0.0005)
{
OrderModify( OrderTicket(), NULL, Ask - 40 * Point, OrderTakeProfit(), 0, Aqua);
}
}
What were doing here is modifying the stop loss if the close price of a particular order falls to 5 pips above the stop loss. My Question is what if the close price of this order falls beyond the stop loss level completely, thereby closing the order; will this code still be executed?
Basically what I'm doing is modifying the stop loss level so that the order doesn't close if the price falls, so that were still in the trade.