This is exploration is run against the S&P 500 watch list using a 
trailing 1 year date range adjusted for a 20 day lead up period. 

I am trying to write an exploration that will check for the following:

Filter= RSILow == LLV(RSI(14),125);

I wan to add columns showing the highest high and lowest low  and 
the  HH LL spread since the filter event at T+5 T+10 T+15 and T+20.

HH5 = Ref(HighestSince(LLV(RSI(14),125) , H, 1 ) ,5);
LL5 = Ref(LowestSince(LLV(RSI(14),125) , L, 1 ) ,5);
R5 = HH5 - LL5;

HH10 = Ref(HighestSince(LLV(RSI(14),125) , H, 1 ) ,10);
LL10 = Ref(LowestSince(LLV(RSI(14),125) , L, 1 ) ,10);
R10 = HH10 - LL10;

HH15 = Ref(HighestSince(LLV(RSI(14),125) , H, 1 ) ,15);
LL15 = Ref(LowestSince(LLV(RSI(14),125) , L, 1 ) ,15);
R15 = HH15 - LL15;

HH20 = Ref(HighestSince(LLV(RSI(14),125) , H, 1 ) ,20);
LL20 = Ref(LowestSince(LLV(RSI(14),125) , L, 1 ) ,20);
R20 = HH20 - LL20;
  


For this code to work in an exploration across a date range I need a 
counter to track the Nth occurrence of the event per ticker for the 
HighestSinceand LowestSince ststments.  Is my approach sound or is 
their a better way to get the results I want?  

I am a novice programmer learning how to write loops.  I am 
completely stuck and do not know how to writ a counter for the Nth 
occurrence of the event.   

Any help would be greatly appreciated.


Reply via email to