Bonjour, @Iván a fait un super boulot avec cet indicateur.
RSI Swing Indicator
J’ai essayé de générer un code pour le convertir en Screener sur ChatGPT, mais il n’y arrive pas.
C’est possible d’en faire un, avec 4 options à sélectionner : LL, HL, LH et HH ?
Merci
Holà. Vous pouvez créer une variable qui est appelée setup et qui varie par exemple de -2 à +2 en fonction de si nous avons un type de pivot ou un autre.
//--------------------------------------------------------------//
//----Inputs----------------------------------------------------//
rsisource=customclose
rsiLength=7
rsioverbought=70
rsioversold=30
//--------------------------------------------------------------//
//-----RSI value------------------------------------------------//
rsivalue=rsi[rsilength](rsiSource)
//-----Current State--------------------------------------------//
isOverbought = rsiValue >= rsiOverbought
isOversold = rsiValue <= rsioversold
//--------------------------------------------------------------//
//-----High and low channel-------------------------------------//
//---Low: calculated when is not overbought
if isOverbought then
notob=0
else
notob=notob+1
pl=lowest[notob](low)
plx=barindex-barssince(pl=low)
endif
//---High: calculated when is not oversold
if isOversold then
notos=0
else
notos=notos+1
ph=highest[notos](high)
phx=barindex - barssince(ph=high)
endif
//--------------------------------------------------------------//
//-----Pivot Points (High&Low)----------------------------------//
//---Check after exit oversold state
if isoversold[1] and not isoversold then
prevlastosx=lastosx//keep the previous pivot barindex
lastosx=plx//set the new pivot barindex
//---Draw only if is the last high
if lastosx>lastobx and prevlastosx < lastobx then
lasty1=y1
//x1=phx[1]
y1=ph[1]
if lasty1 > y1 then
setup=-1
//drawtext("LH",x1,y1+0.5*tr)coloured("red")
else
setup=1
//drawtext("HH",x1,y1+0.5*tr)coloured("red")
endif
endif
endif
//---Check after exit overbought state
if isOverbought[1] and not isOverbought then
prevlastobx=lastobx//keep the previous pivot barindex
lastobx=phx//set the new pivot barindex
//---Draw only if is the last low
if lastobx>lastosx and prevlastobx < lastosx then
lasty2=y2
//x2=plx[1]
y2=pl[1]
if lasty2 > y2 then
setup=-2
//drawtext("LL",x2,y2-0.5*tr)coloured("green")
else
setup=2
//drawtext("HL",x2,y2-0.5*tr)coloured("green")
endif
endif
endif
screener[setup=-2](setup)
Thank you Ivan.
For the indicator, it’s a bit late (5 candles in average) before it draws the green or red dot.
Is there a way to speed it up ?
https://www.prorealcode.com/prorealtime-indicators/rsi-swing-indicator/