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.
i'd like to delete a pending order if the price moved 500 points without executing it
Here's my attempt
CTrade trade; MqlRates pricedata []; ArraySetAsSeries(pricedata,true); int data =CopyRates(Symbol(),Period(),0,550,pricedata); for (int i = OrdersTotal() - 1; i >=0; i-- ) { ulong order_ticket = OrderGetTicket(i); double order_price = OrderGetDouble(ORDER_PRICE_OPEN); double current_open_price = pricedata[0].open; // current price if ( MathAbs(order_price - current_open_price )*_Point > 500 ) trade.OrderDelete(order_ticket); }