Hi I would like to run a scanner with some time window (e.g. from 30 days ago to 20 days ago).
Usually I write it like this:
def endDay = 20;
def periodDays = 10;
def rsi = RSI()."RSI";
def isHigh = Sum(rsi crosses above 70, periodDays)[endDay] > 0;
plot Signal = isHigh;
Which basically start checking if RSI crosses above 70 starting from 20 days ago and going back to 10 days before it (i.e. from 30 days ago to 20 days ago from today).
However, I want to do something that is based on date, something like:
def endDay = (07/04/2021 - today); ---> which gives me roughly 20 days.
Can anyone help how to write this properly?
Thanks!
Usually I write it like this:
def endDay = 20;
def periodDays = 10;
def rsi = RSI()."RSI";
def isHigh = Sum(rsi crosses above 70, periodDays)[endDay] > 0;
plot Signal = isHigh;
Which basically start checking if RSI crosses above 70 starting from 20 days ago and going back to 10 days before it (i.e. from 30 days ago to 20 days ago from today).
However, I want to do something that is based on date, something like:
def endDay = (07/04/2021 - today); ---> which gives me roughly 20 days.
Can anyone help how to write this properly?
Thanks!