Hi,
My screener code looks as follow:
once l=21
once o=3
once m=3
once fast=12
once slow=26
once smooth=9
once n=300
// Define KDJ
hi = highest[l](high)
lo = lowest[l](low)
oscillator = (close – lo) / (hi – lo + 0.001) * 100
rsv = ExponentialAverage[m](oscillator)
k = ExponentialAverage[m](rsv)
d = ExponentialAverage[o](k)
j = 3*k – 2*d
// Define MACD
DIF = ExponentialAverage[fast](Close) – ExponentialAverage[slow ](close) // MACD
DEA = ExponentialAverage[smooth](DIF) // Signal
MyMACD = (DIF-DEA)//*2 // Histo
// Define MJ
KH=highest[n](K)
DH=highest[n](D)
JH=highest[n](J)
KL=lowest[n](K)
DL=lowest[n](D)
JL=lowest[n](J)
KDJMAX=MAX(KH,MAX(DH,JH))
KDJMIN=MIN(KL,MIN(DL,JL))
KDJM2=(KDJMAX+KDJMIN)/2
KDJA2=(KDJMAX-KDJMIN)
DIFH=highest[n](DIF)
DEAH=highest[n](DEA)
MACDH=highest[n](MYMACD)
DIFL=lowest[n](DIF)
DEAL=lowestBars[n](DEA)
MACDL=lowest[n](MYMACD)
MACDMAX=MAX(DIFH,MAX(DEAH,MACDH))
MACDMIN=MIN(DIFL,MIN(DEAL,MACDL))
MACDM1=(MACDMAX+MACDMIN)/2
MACDA1=(MACDMAX-MACDMIN)
NEWBASE=(0-MACDM1)*KDJA2/MACDA1+KDJM2
NewJ = J-NEWBASE
/////////////////////
// Long
long1 = ((NewJ crosses over 0) or (NewJ[1] crosses over 0))
SCREENER[long1] (close * Volume AS “Markt”)
But as I scan the NYSE the result is zero. It must not the truth. Wenn I take out the last 2 lines and set RETURN NewJ as indicator, it works. There must be something wrong?
Hello,
it depends if you have PRT complete version or premium version. Your n=300 used as period for most elements of the code mean they are undefined within the limited 256 screener bars history of PRT complete (while history has been increased to 1024 bars for PRT premium screeners)
I change the n to 255 and it works now.
Many thanks!