Hi anyone that can help. I have been trying to code this EA for a while and getting there slowly, however I am stuck with deleting previous pending orders before opening the next one.
Below is the code I have just before entering either a buy trade and sellstop trade or the other way round. It works as it should do but now I need to add the funtion call to close the previous pending order the /////////////////////////is were I believe the code should go I have also inserted the function that I have come up with for findng the previous pending order(again I am unsurre if this is correct) any help in the right direction would be appreciated
The missing two " { " make your code incomprehensible.
Algorithm for deleting pending orders (I use just this method):
A deletion order is issued (flag m_need_delete_all is raised)
m_need_delete_all=true;
In OnTick it is checked: if the flag m_need_delete_all is cocked, then we begin to delete:
//+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { if(m_need_delete_all) { if(IsPendingOrdersExists()) { double level; if(FreezeStopsLevels(level)) { DeleteAllPendingOrders(level); return; } else return; } else m_need_delete_all=false; } //---
After removal, we check whether there are pending orders left or not: if they remain, we start deleting again. If there are no more pending orders, reset the flag.
Example taken from code: Step Pending Orders

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi anyone that can help. I have been trying to code this EA for a while and getting there slowly, however I am stuck with deleting previous pending orders before opening the next one.
Below is the code I have just before entering either a buy trade and sellstop trade or the other way round. It works as it should do but now I need to add the funtion call to close the previous pending order the /////////////////////////is were I believe the code should go I have also inserted the function that I have come up with for findng the previous pending order(again I am unsurre if this is correct) any help in the right direction would be appreciated