I have written an EA to test a strategy which involves placing a buy and sell pending order at the same price on a grid, with target profit, and once the orders are triggered, another pending order of buy and sell is placed at the next level in the direction of travel. I am not a proficient coder, but trying my best, and the EA seems to be doing what I want it to do to an extent. The one issue I am stuck on is this. I want it that if an order does not hit its target profit, I don't want the next next pending order for that order type to have a target profit, but I don't know how to code to identify and establish which order (buy or sell) just hit the target profit. I will give an example to clarify:
GBPUSD, buy and sell orders triggered at 1.24. Buy TP at 1.25, Sell TP at 1.23. Price moves up and hits 1.25, buy order TP hit and closed. Now I want next buy and sell pending order placed at 1.26, with buy TP at 1.27, but no TP for the sell order. How can I code to determine which order type (buy or sell) hit its TP last? Thank you
GBPUSD, buy and sell orders triggered at 1.24. Buy TP at 1.25, Sell TP at 1.23. Price moves up and hits 1.25, buy order TP hit and closed. Now I want next buy and sell pending order placed at 1.26, with buy TP at 1.27, but no TP for the sell order. How can I code to determine which order type (buy or sell) hit its TP last? Thank you