amitgvarun:
I have following code that is giving different result with two different for loops
1. for (i=0, i<10,i++);
2. for (i=10,i>0,i--);
Play videoPlease edit your post.
For large amounts of code, attach it.
- You didn't show any real code and there are no mind readers here.
- But since you get different results, you are using left over values in your variables from one iteration to the next.
limit=Bars-counted_bars; for(int i=0; i<limit; i++){ : if((a1>0) && (d1==45678))
Limit will normally be 1 so a1 and d1 MUST be calculated either inside the loop or before the loop starts using only OHLC or your buffer[limit] - Always count down.
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
I have following code that is giving different result with two different for loops
1. for (i=0, i<10,i++);
2. for (i=10,i>0,i--);
sample code is
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for(int i=0; i<limit; i++)
{
...
....
....
if((a1>0) && (d1==45678))
{
..
..
}
else if((a1<0) && ( d2==45678))
{
..
..
}
some having some idea......