Hi. I am trying to write a scan, but I have an issue with my script. Please help.
I want to return results where the ADX > 30 and the stock has made a new 63 day closing low. I want both of these to have happened sometime in the last 21 days. Here is what I have that is not working:
//Is ADX > 30
V1 = ADX() > 30 ;
//Is today a new 63 day low?
V2 = Close() < LOWESTLOW(BARS=63, INCBAR=True) ;
//Did these occur in the last 21 days?
TIMESINCESIGNAL(V1) <=21 and TIMESINCESIGNAL(V2) <= 21
In the scanning manager I did change the date range to: last year.
Thank you, Louis.
The issue is with the Lowest Low line, you have the Close crossing below a Low which is set to include the current day, so the criteria would never be met. Once this was changed to Low() == instead of close, the script returned the expected results.
Full Script
//Is ADX > 30
V1 = ADX() > 30 ;
//Is today a new 63 day low?
V2 = Low() == LOWESTLOW(BARS=63, INCBAR=True) ;
//Did these occur in the last 21 days?
TIMESINCESIGNAL(V1) <=21 and TIMESINCESIGNAL(V2) <= 21
One of the codes that passed was ATVI, and when checked manually on the chart you can see the criteria have been met.