No, it won't.
As you have not showed any code that may be causing problems, I doubt that anyone can help you
for(int cnt=0; cnt<OrdersTotal() ; cnt++)
Obviously this is a condition for a loop, but we have no idea what you do in the loop.
for(int cnt=0; cnt<OrdersTotal() != 0; cnt++)
Most likely, if you have more than 1 open order, it will only loop once.
OrdersTotal() != 0
will probably equate to 1 as it is a boolean test. I'm surprised that you don't get a warning when compiling.
- Post real code (that compiles) using SRC.
for(int cnt=0; cnt<OrdersTotal() != 0; cnt++) for(int cnt=0; 0 < N != 0; cnt++) // if OrdersTotal > 0 for(int cnt=0; true != 0; cnt++) for(int cnt=0; 1 != 0; cnt++) // true = 1 for(int cnt=0; true ; cnt++) // Infinite loop!
true = 1 and false = 0 so you getif( 3 < 2 < 1 ) if( false < 1 ) if( 0 < 1 ) if( true )
if( 3 > 2 > 1 ) if( true > 1 ) if( 1 > 1 ) if( false )
for(int cnt=0; cnt<OrdersTotal() != 0; cnt++)
Surely, if any orders are open
OrdersTotal() != 0
Will be true, so equate to 1, which will make the condition the same as
for(int cnt=0; cnt<1; cnt++)
First pass of the loop, cnt < 1, so loop code will be executed and cnt is incremented
2nd pass of the loop will not happen because cnt=1 , not smaller than 1
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,
I am having problems with my code, I am personally opening 1 trade at a time per EA window but i have been told that numerous trades open for other people.
Currently i have this code here:
in start()
double stoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
double stoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
OrderBuy=0;
OrderSell=0;
for(int cnt=0; cnt<OrdersTotal() ; cnt++)
I have replaced it with this now:
int start()
double stoplevel=MarketInfo(Symbol(),MODE_STOPLEVEL);
OrderBuy=0;
OrderSell=0;
for(int cnt=0; cnt<OrdersTotal() != 0; cnt++)
Will this fix my issue?