Here ya go....
output = "brkout310.lst"; input = "vol250.lst"; //ProcessMS = "e:\breakout\brkout310",MSdata;
integer numDaysToExclude; // Number of days to back to exclude integer triggeredPrior; // Boolean Flag integer i; // Index Variable
numDaysToExclude := 1; triggeredPrior := 0;
numDaysToExclude := numDaysToExclude * -1;
for i = numDaysToExclude to -1 step 1 do if ( close(i) > max(i-1,i-20,hi) or close(i) < min(i-1,i-20,lo) ) and ( Vol(i) > (AvgVol(i,i-40)*1.4) ) then triggeredPrior := 1; endif; next i;
if ( close(0) > max(-1,-20,hi) or close(0) < min(-1,-20,lo) ) and ( Vol(0) > (AvgVol(0,-40)*1.4) and (triggeredPrior = 0) ) then println symbol , "," , Description; endif;
The trick is to use a loop to back test and set a flag if a match occurs. Then when scanning the final day check to see that the flag has not been set.
change numDaystoExclude to exlcude more matches as you go back in time.
Sean |