Malgré la saisie show S/R en début de code, pas d’affichage graphique !?
defparam drawonlastbaronly = true
defparam calculateonlastbars = 500
showSR = 1
//fractals
cp = lookback
if high[cp] >= highest[(cp)*2+1](high) then
LLH = 1
else
LLH = 0
endif
if low[cp] <= lowest[(cp)*2+1](low) then
LLL = -1
else
LLL = 0
endif
if LLH = 1 then
oldLTOPy = LTOPy[1]
oldLTOPx = LTOPx[1]
LTOPy = high[cp]
LTOPx = barindex[cp]
endif
if LLL = -1 then
oldLBOTy = LBOTy[1]
oldLBOTx = LBOTx[1]
LBOTy = low[cp]
LBOTx = barindex[cp]
endif
//trend line
DRAWLINE(oldLTOPx,oldLTOPy,LTOPx,LTOPy)coloured(112,169,161)
DRAWLINE(oldLBOTx,oldLBOTy,LBOTx,LBOTy)coloured(211,78,36)
//support/resistance
if showSR then
DRAWHLINE(LTOPy) COLOURED(207,215,199,100)
DRAWHLINE(LBOTy) COLOURED(207,215,199,100)
endif
barelapsedTOP=barindex-LTOPX
barelapsedBOTTOM=barindex-LBOTX
factorTOP = (LTOPy-oldLTOPy)/(LTOPx-oldLTOPx)
factorBOTTOM = (LBOTy-oldLBOTy)/(LBOTx-oldLBOTx)
//drawtext("#factor#",barindex,low-10*pipsize,Dialog,Bold,20)
nowTOP = LTOPy+(barelapsedTOP*factorTOP)
drawtext("X",barindex,nowTOP,Dialog,Bold,20) coloured(112,169,161)
nowBOTTOM = LBOTy+(barelapsedBOTTOM*factorBOTTOM)
drawtext("X",barindex,nowBOTTOM,Dialog,Bold,20) coloured(211,78,36)
RETURN nowTOP coloured(110,0,0,0), nowBOTTOM coloured(110,0,0,0)