- Please edit your (original) post and use the CODE
button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Messages Editor - Your code breaks if you have positions open on other symbols.
How to Code OrderDeletion on Specific Pair!! PLEASE HELP!!
I am trying to code a break out EA that uses a BuyStop and a SellStop 1pip away from price. The problem is once one of the orders gets triggered I would like the other order to DELETE.
This is what I have so far:
But it instead closes one order before it even enters a position (PositionsTotal hits 1)
Please insert the code using the button
(I
corrected your message). For reliability, you need to use the following algorithm: in OnTradeTransaction, catch the transaction
TRADE_TRANSACTION_DEAL_ADD. If the transaction DEAL_ENTRY_IN generated the transaction and the symbol of the transaction and the magic
number of the transaction match your settings, then you can start deleting pending orders.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How to Code OrderDeletion on Specific Pair!! PLEASE HELP!!
I am trying to code a break out EA that uses a BuyStop and a SellStop 1pip away from price. The problem is once one of the orders gets triggered I would like the other order to DELETE.
This is what I have so far:
But it instead closes one order before it even enters a position (PositionsTotal hits 1)