That's one complex approach. why not just call the checking function when the tp is hit, which will then find the pending order and close it? This wouldn't work if you intend to use multiple orders, but a work-around would be, giving simultaneous orders same magic. Then when a trade hits a tp, find the other order with similar magic and delete it.
Lol! Good luck though.
well, im working in a expert that open a sell oder and a sell stop order at the same time (hedging) im stok in the part where im triying to store the order number of the sell order and the sell stop order in an array to make a function that when the sell order raise the take profit delete the SellStop order.
(Please excuse my english, im trying to translate my spanish. Let mi know if you can understand my problem)
Your logic makes no sense.
First of all opening a sell and a sell stop order is not "hedging".
If the sell stop order is between the sell price and take profit price, you can't delete the stop order as it will already have triggered before the TP was hit.
If the stop order entry is below the TP, the TP will always be hit before the stop order triggers, so what is the point of placing the stop order when it will always be deleted?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
well, im working in a expert that open a sell oder and a sell stop order at the same time (hedging) im stok in the part where im triying to store the order number of the sell order and the sell stop order in an array to make a function that when the sell order raise the take profit delete the SellStop order.
(Please excuse my english, im trying to translate my spanish. Let mi know if you can understand my problem)