Current price lower than lows of specific time span


Category:
0
0

I am doing stock scan filter and would like to find stocks for which the current price is lower than the lowest price of a specific period, say from 20200420 till 20200510. How to do it? Thanks.

Marked as spam
Posted by (Questions: 3, Answers: 5)
Asked on June 14, 2020 9:58 pm
152 views
0
Private answer

Please note the end date you have selected is a day markets were not open for trading. We can still use that date for THIS solution. But only because the code has been crafted to allow for that. Whenever using specific dates in any custom study or scan it's best to stick with dates the markets were open for regular trading.

input startDate = 20200420;
input endDate = 20200510;
def targetPeriod = DaysFromDate(startDate) >= 0 and DaysTillDate(endDate) >= 0;
def beginTargetPeriod = targetPeriod and !targetPeriod[1];
rec trackTargetLow = if beginTargetPeriod then low else if low > 0 and targetPeriod and low < trackTargetLow[1] then low else trackTargetLow[1];
plot scan = low < trackTargetLow;

Marked as spam
Posted by (Questions: 37, Answers: 4089)
Answered on June 15, 2020 8:05 am
0
It is great. Thanks a lot.
( at June 15, 2020 9:32 pm)