I’d like to iterate from Test Start Date to Test End Date
Just do this
bir = Status( "barinrange" );
for( i = 0; i < BarCount; i++) {
if( bir[i] ) { // if code iterates within range from-to of analysis toolbar
// then do something
}
}
How is that nice and clean? It is neither one nor is it the other one nor is it flexible. It is rather bad idea doing it that way. If that one is nicer and cleaner than using “barinrange” status code then I seem to have accidentally jumped into a parallel universe (Sam Beckett, are you there? Or “Sliders” perhaps?) where nice and clean have different meanings.
Just imagine, you would have to do two loops if you want to iterate through entire barcount for one code section in addition to your analysis range iteration approach. In addition such approach is bloated and unnecessary over-complication.
// BAD idea
myStart = LastValue(ValueWhen(Status("FirstBarInRange"), BarIndex()));
myEnd = LastValue(ValueWhen(Status("LastBarInRange"), BarIndex()));
for( i = myStart; (i <= myEnd); i++ ) {
//your first code iterating bars of range
}
for( i = 0; i < Barcount; i++ ) {
//your other code (requiring) looping entire barcount or whatever
}
compared to flexible loop
// Good and the real nice and clean one
bir = Status( "barinrange" );
for( i = 0; i < BarCount; i++) {
// code iterating entire barcount or whatever
if( bir[i] ) { // your code iterating bars of analysis range
// then do something
}
// or code here iterating entire barcount or whatever
}
So it would have made more sense (to me) if you would have written “I prefer doing things like so” (less nicer, less cleaner, less flexible). Then personally I wouldn’t have any reason to argue about it (and with less hairs standing up) and begging your pardon.
Just so many rather bad (code) ideas on the Internet.