I am trying to define a condition referring to the Historic Low of a value (taking into account the limitation of 1024 candles). Lowest[1023](Low).
The problem arises whith stocks that have traded fewer candles than those indicated in the Lowest command (i.e. IPO occured less than 1023 candles ago). Whith such stocks, ProScreener will directly ignore them from the result, even if all conditions are correct. Note: This problem occurs in Lowest, Highest and other commands that involve earlier candles.
I have simplified a code below for the sake of the example.
1
2
3
4
5
6
7
8
c1=Close>1.5
c2=Close<1.55
HistoricLow=Lowest[160](Low)
c3=HistoricLow>0
Screener[c1andc2andc3]
The first two conditions are intended to narrow down the list and only show a specific stock (LDA – Linea Directa) that has been trading in the Spanish market only for a few sessions. This ProScreener should only apply to Stocks in Spain for simplicity, but feel free to do you own testings.
Then third condition states that the lowest traded value during the last 160 candles must be greater than 0 (obviously the condition will be correct). But because LDA to date has only traded 156 sessions, despite the fact that the 3 conditions are correct, it will not appear in the ProScreener result. If you introuce Lowest[100](Low) however, it will work fine.
Do you know if there is a way to fix this error, maybe with a different code?
I thought about something like: MIN (sessions traded, 1023) but I have not been able to find a way to identify the number of sessions traded to date.
To help us continually offer you the best experience on ProRealCode, we use cookies. By clicking on "Continue" you are agreeing to our use of them. You can also check our "privacy policy" page for more information.Continue