So below I have provided the code for a chart label that counts the amount of time a stock has spiked in the past (aka a former runner). My question is, how can we turn this into scan criteria. When using this scanner, I only want to return stocks that have spiked at least 1 day in the past on the daily chart in the within past 2 years. This code works well as a label, now let’s see if we can create a scan.
input percentSpike = 40.0;
input countLimit = 5;
def percentRise = 100 * (high / open – 1);
def condition = percentRise >= percentSpike and volume > 5000000;
rec counter = if condition and BarNumber() >= 0 then counter + 1 else counter;
*Bonus, this will be even cooler if we can add a slider (optional)
Marked as spam
Please log in to post questions.