Hello,
I would like to know if it possible ,and how , to use a 'For ( ) { .. }'loop ,
, with golabl afl instructions .
Hencemore I wish to exit fromthe inside of this 'for...' loop before its 'natural' end ,
i.e when a condition set by the instructions within the loop is fulfilled .
For example , to Exit of a Loop that calculate , for each bar , the Highest HIGH over different period of time , as soon as one of the Highest High computed within the loop , is Higher than 100 $ .
I tried this code :
For ( period = 0 ; period < 20 ; period++) { // Loop over the last 20 bars
HighestHigh = HHV(High,period) ; // Highest HIGH over the prevous 'Period' bars - instruction Ok
// ==> return an historical array
// To Exit the 'for' loop , I have tried those two kind of instructions :
// --------------------------------------------------------------------
if ( HighestHigh[period] > 100 ) break ; // Exit loop 'for...' , if HighestHigh calculated over 'period' bars, is over 100 ($)
// The logic of this instruction doesn't works properly for all bars of the history .
// It apply perhaps only to the first bar of the history ?
// Or :
period = iif ( HighestHigh > 100 , 99999,period) ; // invalid instruction ; it returns an history array not suitable with the type of parameter of the 'for...' loop.
}
Is there a smart guy that know to handle this kind of logic with global .afl instructions ?
Thanks ,