How to check open orders and to close certain

Play videoPlease edit your post.
For large amounts of code, attach it.
- So do an OrderSelect loop. Filter by your magic number and symbol. Count them.
- What are Function return values ? How do I use them ? - MQL4 forum
- Adjust for 4/5 digit brokers. TP, SL, AND slippage. Adjust for ECN brokers.
- Never use NormalizeDouble ever, it's a kludge, it's always functionally wrong. You only need to NormalizePrice for pending orders. You must NormalizeLots properly. You only need to compare doubles properly.
Hello Please tell me how to add validation code Babe closing before opening. If you can give an example of code bude very grateful, but then I'm a newbie. thank you
if (a>b)
{
It checks for the presence of open orders to buy, and if they have what you need to close them and continue opening sell orders.
OrderSend(Symbol(),OP_SELL,Lot,Bid,3,DownTrend_Line_1,NormalizeDouble(Bid - SellTP*Point,Digits));
}
else if (a<b)
{
It checks for the presence of open orders to sell, and if they have what you need to close them and continue opening buy orders.
OrderSend(Symbol(),OP_BUY,Lot,Ask,3,UpTrend_Line_1,NormalizeDouble(Ask + BuyTP*Point,Digits));
}