for(int i=OrdersTotal();i>0; i--)
Change to
for(int i=OrdersTotal()-1;i>=0; i--)
.
for(int i = 0; i < OrdersTotal(); i++)
i should be 0 and count upto OrdersTotal()
Just so you know, your OrderSelect(i, SELECT_BY_POS) starts from 0, if you have 1 order, selecting order 1 wont exist because its indexed from 0 like most arrays.
Keelan:
for(int i = 0; i < OrdersTotal(); i++)
i should be 0 and count upto OrdersTotal()
Absolutely not!!
When closing orders ALWAYS count down.
In the presence of multiple orders (one EA multiple charts, multiple EA's, manual trading)
you must count down when closing/deleting/modifying in a position loop. Get in the habit of always counting down. Loops and Closing or Deleting Orders - MQL4 forum
Thanks.
Why? i iterate through my Orders in ascending order and nothings broke yet, dont have to use FIFO or LIFO? or is it an mql thing?
Keelan:
Why? i iterate through my Orders in ascending order and nothings broke yet, dont have to use FIFO or LIFO? or is it an mql thing?
WHRoeder posted a link that will tell you why
Why? i iterate through my Orders in ascending order and nothings broke yet, dont have to use FIFO or LIFO? or is it an mql thing?
Hi im new..
there is a function to selecting a symbol :
SymbolSelect();
i dont know how to use it in order to select for example EURUSD symbol, can you please write exactly the code which select the symbol EURUSD ?
thanks
there is a function to selecting a symbol :
SymbolSelect();
i dont know how to use it in order to select for example EURUSD symbol, can you please write exactly the code which select the symbol EURUSD ?
thanks
mahmood0:
Hi im new..
there is a function to selecting a symbol :
SymbolSelect();
idont know how to use it in order to select for example EURUSD symbol,can you please write exactly the code which select the symbol EURUSD ?
thanks
there is a function to selecting a symbol :
SymbolSelect();
idont know how to use it in order to select for example EURUSD symbol,can you please write exactly the code which select the symbol EURUSD ?
thanks
I am wasting a lot of time deleting your replicated posts.
Don't double post
You are banned for 1 month and lucky that it is not permanent!
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi there,
I manually opened a BUY order and ran the below code:
It generated the below output:
The trade tab shows an active order of 0.01 lots:
What changes do I need to make to be able to delete active orders please?
Kind regards.