hQrGrIg8lY
New member
I see the following code to scan for average volume above a threshold. I'd like to scan stocks who today's volume is n times the average volume of previous m days.
Does anybody know how to adjust the code to do the task that I want to solve?
Average()
does not have a parameter to skip the current day.Does anybody know how to adjust the code to do the task that I want to solve?
Code:
input price = volume;
input length = 50;
input averageType = {default Simple, Exponential, Weighted, Wilders, Hull};
input choice2 = {default "greater than", "less than"};
input Choice = 1000000;
def avg;
switch (averageType) {
case Simple:
avg = Average(price, length);
case Exponential:
avg = ExpAverage(price, length);
case Weighted:
avg = wma(price, length);
case Wilders:
avg = WildersAverage(price, length);
case Hull:
avg = HullMovingAvg(price, length);
}
plot scan;
switch (choice2) {
case "greater than":
scan = avg > choice;
case "less than":
scan = avg < choice;
}