I’m wondering about an AFL for stocks that have went up 100% in the past year. I know I can do something like:
Filter = (HHV(C, 252) - LLV(C, 252)) / LLV(C, 252) >= 1
But, how can I write a formula so that the value for the HHV is from a date after the LLV value’s date?
It sounds like you're looking for stocks that have had a move of greater than 100% from their lowest close in the last year, rather than stocks that have gone up 100% from their price a year ago? If it's the former, then what you're looking for is HighestSince(). So first work out the lowest close in the last year, then find the highest close since then, and calculate the percentage size of that swing. eg
LowestClose = LLV(C, 252);
HighestCloseSince = HighestSince(C == LowestClose, C);
SwingSize = (HighestCloseSince / LowestClose - 1) * 100;
Filter = Status("LastBarInRange") AND SwingSize > 100;
Results for S&P500:
Thank you HelixTrader, this is perfect.