I've read through the manual, and the only solution I found is to use another nested loop or a loop-based function to break the main loop. Calling a [for(i=0;i<BarCount;i++)] loop at every iteration of the main loop is very inefficient. There must be a way to break a loop with an array-based condition...
The manual goes into details and gives source code that includes the answer to the very question you asked - at the bottom of the page. What's more you did not even read the @awilson answer (single line) - the one where he just wrote you:
if TestCondition is an array inside loop you need to use TestCondition[x]
Unfortunately "x" in my loop doesn't match bar Nrs, so TestCond[25/30/35/40/45/50] would not match data bars in my case.
I've read through the manual, and only found [for(i=0;i<BarCount;i++)] loop solutions. If you have a solution, please post it here.
In 90% of cases when you need loops in Python, you can write a simple native vector (array) statement in AFL which runs at the assembly speed (hyper fast). You need to un-learn slow ways (loops) and learn new ways (array/vector) to write compact and fast formulas.
Newbie like you should rather start with describing his goal in plain English than trying to write half-baked (incorrect) code.
There is no slight description of what your code is SUPPOSED to do. And your code does not tell that either. In the code that you posted the for loop and the if-statement is nonsense because TestCond is loop-invariant (does not depend on loop counter).
This could change if you provided skipped part (//additional code part). Because of that no-one really knows what in your mind you really wanted to write. For this reason it is better to describe the goal in plain English. Or write full formula as I suggested earlier (without skipping // additional code).
@ojacopo your posts above show, that your knowledge regarding AmiBroker and programming in AFL is very limited, so please restrain yourself from expressing such groundless and unfair opinions... It's not a good idea to criticize in your first posts on this forum, something that you clearly don't understand! In a similar way, you could criticize Boeing or Airbus for making such bad planes just because you can't fly them
I can only imagine how frustrating it is for Tomasz, to defend himself (for the n-th time ) against such ridiculus accusations