See Sum function. http://www.amibroker.com/guide/afl/afl_view.php?id=151
non_above = Sum(Ref(a, -1) < Ref(b, -1), 6) == 6; Mike --- In [email protected], Pablo Bozzolo <boctu...@...> wrote: > > Hi! could someone help me whith a function ? > > The idea es return something like .... > > function non_above (a,b){ > return ( (Ref (a,-1)<Ref (b,-1)) AND (Ref (a,-2)<Ref (b,-2)) AND (Ref > (a,-3)<Ref (b,-3)) > AND (Ref (a,-4)<Ref (b,-4)) AND (Ref (a,-5)<Ref (b,-5)) AND (Ref > (a,-6)<Ref (b,-6)) AND ... AND ... ); > } > > And I've tried something but It's no working maybe because I've no idea how > work with the last N-bars > > function non_above (a,b){ > bars = 6; // parameter > above= False; > for( i = BarCount-bars; i<BarCount-1; i++){ > if (a[i]>b[i]){ > above = True; > break; // also not working! > } > } > return (NOT above); > } > > ANY help will be aprecciated! Pablo >
