Hi, I am trying to setup a simple screener to identify stocks in both a ST and LT uptrend.
It is pretty simple but I am getting results that are not correct. I have tried a number of variations of the code and the current one has the LT trend calculation as the screener. The screener (LT trend calc, which is the EMA144/EMA233) gives me a figure of greater than one but when I look at some of the results the EMA233 is clearly above the EMA144 which would result in a screener calcuation of less then 1 but that is not the result given.
See attached eg for Alderan resources (AL8). Of the 43 results, at least 6 are incorrect.
REM Calculate a exp moving average over the last 21 days
ema21 = ExponentialAverage[21](close)
REM Calculate a exp moving average over the last 34 days
ema34 = ExponentialAverage[34](close)
REM Calculate a exp moving average over the last 144 days
ema144 = ExponentialAverage[144](close)
REM Calculate a exp moving average over the last 233 days
ema233 = ExponentialAverage[233](close)
LTtrend = ema144/ema233
STtrend = ema21/ema34
REM if both LT and ST trend is up
IF LTtrend >1 then
if STtrend >1 THEN
SCREENER (LTtrend AS "Trend")
endif
ENDIF
JSParticipant
Veteran
Hi
@langdon
ProScreener uses the last 256 bars (Premium 1024 bars) to make calculations, probably your EMA233 needs more history for a correct calculation…
Yes, as
JS said, EMAs require more than twice the periods written within brackets, thus exceeding the built-in limits.