How can close grid orders by selecting wanted orders

 

as show in pictue ,sell order total is 5 orders

I want to close 0.05 lot sell order and 0.02 sell orders / not all orders /

How can do this

Can count existing orders, how many buy sell orders but how can select as above logic.

by also ticket , 1st open ticket and last open ticket can select , but how can select as above logic

give me some idea

 
  1. LONNV: How can do this
    Select only what you want in your order select loop. Show us your attempt (using the CODE button) and state the nature of your problem.
              No free help (2017.04.21)

    Magic number only allows an EA to identify its trades from all others. Using OrdersTotal/OrdersHistoryTotal (MT4) or PositionsTotal (MT5), directly and/or no Magic number/symbol filtering on your OrderSelect / Position select loop means your code is incompatible with every EA (including itself on other charts and manual trading.)
              Symbol Doesn't equal Ordersymbol when another currency is added to another seperate chart . - MQL4 programming forum (2013)
              PositionClose is not working - MQL5 programming forum (2020.02.21)
              MagicNumber: "Magic" Identifier of the Order - MQL4 Articles (24 July 2006)
              Orders, Positions and Deals in MetaTrader 5 - MQL5 Articles (1 February 2011)

    You need one Magic Number for each symbol/timeframe/strategy.


  2. LONNV: as show in picby also ticket , 1st open ticket and last open ticket can select , but how can select as above logic

    give me some idea

    In your order select loop, remember the newest selected, once. Show us your attempt (using the CODE button) and state the nature of your problem.