Hi Mike's solution appears fine. Another approach - which can include a predefined # of bars since cross over 200 or not - array=CCI(20); BarssinceCCICrossed200=BarsSince(Cross(array,200);
BarssinceCCIcrossedUNDER90=BarsSince(Cross(90,array); YourSignal=BarssinceCCICrossed200 < ref(BarssinceCCIcrossedUNDER90,-1) and Cross(90,array) The problem with Mike's solution is 210...10..91..88today within the time window will give a hit The problem with my solution is 210...89.9...199..80today will give a miss. Why not play with trying to use elements of both? Dan --- In [email protected], "murthysuresh" <mo...@...> wrote: > > the CCI should have crossed 200. Once it crossed 200, it should have have > crossed below 90. > i got the first one right as below > array = CCI( 20 ); > BarsSinceCCICrossed200=BarsSince(Cross(array,200)); > > without using a for loop, how can i code the second condition. > Once it crossed 200, it should have have crossed below 90. >
