Buon giorno chiedevo uno screner daily che estragga azioni con i seguenti parametri:
dalla prima candela daily del mese sommo o sottraggo il valore dell ATR (a 20 periodi) cosi da trovare un canale per andare long o short alla rottura.
vorrei che mi estraesse i titoli che hanno raggiunto questa condizione di valore ATR in piu o in meno dalla chiusura daily primo gg del mese. Grazie.
Ecco:
atr=averagetruerange[20](close)
if openmonth<>openmonth[1] then
checkLevelUp = close+atr
checkLevelDn = close-atr
firstUp=0
firstDn=0
endif
if close crosses over checkLevelUp and firstUp=0 then
firstUp=1
elsif close crosses under checklevelDn and firstDn=0 then
firstDn=1
endif
setupLong=firstUp and firstUp[1]=0
setupShort=firstDn and firstDn[1]=0
screener[setupLong or setupShort](setupLong as "Long",setupShort as "short")
Eccolo:
Cond = 0
FOR i = 0 TO 31
IF OpenMonth[i] <> OpenMonth[i + 1] THEN
myATR = AverageTrueRange[20](close[i])
Apertura = Open[i]
BandaSup = Apertura + myATR
BandaInf = Apertura - myATR
IF (close[i] >= BandaSup) THEN
Cond = 1
ELSIF (close[i] <= BandaInf) THEN
Cond = 2
ENDIF
break
ENDIF
NEXT
SCREENER[Cond](Cond AS "1=Sup, 2=Inf")
questo è un indicatore per vedere le bande sul grafico:
myATR = AverageTrueRange[20](close)
Apertura = Open
BandaSup = Apertura + myATR
BandaInf = Apertura - myATR
RETURN BandaSup AS "Banda Superiore",BandaInf AS "Banda Inferiore"