Buonasera a tutti,
vorrei chiedere cortesemente un aiuto per risolvere un problema che non riesco a risolvere:
creare un Box prendendo in esame il Supertrend.
In particolare se il Supertrend si “stabilizza” per almeno 5 candele vorrei disegnare un Box che abbia come base (o tetto) la linea del Supertend e come tetto (o base) il massimo (o minimo) della serie di candele in esame.
Grazie.
Allego esempio
Questo mi sembra vada bene:
myST = SuperTrend[2,10]
IF summation[5](myST = myST[1]) = 5 THEN
Upper = max(myST,highest[5](high))
Lower = min(myST,lowest[5](low))
DrawRectangle(BarIndex-4,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
ENDIF
RETURN
Molte grazie Roberto.
Se possibile vorrei chiederTi se puoi aggiornare il codice:
se il Supertrend rimane “stabile” per più di 5 candele il Box dovrebbe proseguire fino a quando il Supertrend non cambia inclinazione.
Il mio problema era questo cioè creare un ciclo che controllasse il Supertrend ad ogni candela.
Grazie
Scusa Roberto, ho provato a modificare il tuo codice ma non riesco a visualizzare il Box.
Per cortesia riesci a correggerlo?
Grazie.
Allego il codice
myST = SuperTrend[2,10]
ONCE CONT = 1
IF summation[CONT](myST = myST[CONT]) THEN
IF CONT >= 5 then
Upper = max(myST,highest[CONT](high))
Lower = min(myST,lowest[CONT](low))
DrawRectangle(barindex-CONT,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
CONT = CONT + 1
ELSE
CONT = CONT + 1
ENDIF
ENDIF
RETURN
Ho riscritto il codice così:
myST = SuperTrend[2,10]
ONCE CONT = 1
IF summation[CONT](myST = myST[CONT]) THEN
IF CONT >= 5 then
Upper = max(myST,highest[CONT](high))
Lower = min(myST,lowest[CONT](low))
DrawRectangle(barindex-CONT,Upper,BarIndex,Lower) coloured("Cyan",90) bordercolor("Red",0)
CONT = 0
ENDIF
CONT = CONT + 1
ENDIF
RETURN
prova se così va bene.