What do you think this statement does? It compares i <= Bars, which is always true, then assigns one (true) to i. You're comparing Low[i] < Low[1] with i being one always. Infinite loop. | i=i<=Bars; |
If i equals Bars, the Low[i] is an array exceeded error, and your program dies. | i<=Bars; |
You said you want "to get the bar number", then why are you returning true? | return(true); |
Brian Kester: is there a faster way than this to get the bar number?
if(Low[i]<Low[1])
-
Play videoPlease edit your post.
For large amounts of code, attach it. - Array accesses are 10x slower than variables. Put the Low[1] in one since it isn't changing.
Brian, please do not modify the code in the first post. It makes WHRoeder's reply seem nonsense because we don't realise that you have edited the code.
If you change the code, put it in a new post.

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
if the next lower bar is 100,000 bars back, is there a faster way than this to get the bar number?
//--- starting with last closed bar, find next lower low
int next_lower_low()
{
for(int i=2;i<Bars;i++)
{
if(Low[i]<Low[1])
return(i);
}
return(0);
}