Bonjour
je souhaiterai savoir comment lisser RSI avec une moyenne mobile Vidya.
Voici le début du code mais il renvoie un signal d’erreur.
Merci beaucoup pour votre aide
//Vidya
//Période = 14
si barindex>100 alors
k=abs(Chandle[20](fermer))/100
alpha=2/(14+1)
vidya=(alfa*k*fermer+(1-alfa*k )*vidya[1])
fin si
//retourne Vidya, Fermer
//lisserRSI = moyenne[val, moyenne](RSI[rsival])
smoothrsi= moyenne [14,vidya] (RSI[rsival])
//Parcelles
TIRAGE( ob )
DRAWHLINE(os)
STYLE DRAWHLINE(50) (DOTTEDLINE3)
renvoie smoothRSI comme "RSI Lissé"
//Vidya
//Period = 14
if barindex>100 then
k=abs(Chandle[20](close))/100
alfa=2/(14+1)
vidya=(alfa*k*close+(1-alfa*k)*vidya[1])
endif
//return vidya, Close
//smoothRSI = average[val, aver](RSI[rsival])
smoothrsi= average [14,vidya] (RSI[rsival])
//Plots
DRAWHLINE(ob )
DRAWHLINE(os )
DRAWHLINE(50) STYLE (DOTTEDLINE3)
return smoothRSI as "RSI Lissé"
JSParticipant
Senior
Hi,
I think you should replace the “Close” with the “RSI”…
Period = 14
xRSI=RSI[14](Close)
if barindex>100 then
k=abs(Chandle[20](xRSI))/100
alfa=2/(Period+1)
vidya=(alfa*k*xRSI+(1-alfa*k)*vidya[1])
endif
DrawHLine(70) Coloured("Blue")
DrawHLine(30) Coloured("Blue")
return vidya Coloured("Red"), xRSI
JSParticipant
Senior
Hi @Bateson
What happens here is that you apply the Vidya to the “RSI[14]”…
The result is a “smoothed” RSI…
Merci beaucoup pour le temps passé 🙂
je comprends que ma question n’est pas tres claire.
Votre réponse m’a déjà fait beaucoup progresser…
ce que je voudrai c’est que la Vidya ne soit pas “sur” le RSI mais “dans” le calcul du RSI… mais ca n’est peut être pas clair 🙁
Merci infiniment en tout cas pour le temps passé
Bonjour
J’ai finalement réussi à trouver sur PRT ce que je cherchais.
Pourriez vous m’aider à traduire le code suivant pour PRT ?
Merci d’avance !
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © bartua
// Optimized Trend Tracker function under copyright and courtesy of KivancOzbilgic.
//@version=5
indicator("RSI Wave Signals", overlay=false)
period1 = input(2,"Period For MA")
mtp1 = input.float(0.7,"Trailing Percentage of MA",step=0.1)
rsiLength = input(12,"RSI Length")
ottFunction(src,length,percent)=>
valpha=2/(length+1)
vud1=src>src[1] ? src-src[1] : 0
vdd1=src<src[1] ? src[1]-src : 0
vUD=math.sum(vud1,9)
vDD=math.sum(vdd1,9)
vCMO=nz((vUD-vDD)/(vUD+vDD))
VAR=0.0
VAR:=nz(valpha*math.abs(vCMO)*src)+(1-valpha*math.abs(vCMO))*nz(VAR[1])
MAvg=VAR
fark=MAvg*percent*0.01
longStop = MAvg - fark
longStopPrev = nz(longStop[1], longStop)
longStop := MAvg > longStopPrev ? math.max(longStop, longStopPrev) : longStop
shortStop = MAvg + fark
shortStopPrev = nz(shortStop[1], shortStop)
shortStop := MAvg < shortStopPrev ? math.min(shortStop, shortStopPrev) : shortStop
dir = 1
dir := nz(dir[1], dir)
dir := dir == -1 and MAvg > shortStopPrev ? 1 : dir == 1 and MAvg < longStopPrev ? -1 : dir
MT = dir==1 ? longStop: shortStop
OTT=MAvg>MT ? MT*(200+percent)/200 : MT*(200-percent)/200
[dir,OTT[2],MAvg]
//MACD Calculations//
rsi = ta.rsi(close,rsiLength)+1000
[dir1,ott1,sl1] = ottFunction(rsi,period1,mtp1)
plot(ott1,title="OTT",linewidth=1,color=color.white)
plot(sl1,title="SL",linewidth=2,color=color.aqua)
overSoldLevel = input(40,title="Oversold Level") +1000
overBoughtLevel = input(60,title="Overbought Level") +1000
plot(overSoldLevel, title="Oversold",style=plot.style_circles,color=color.blue)
plot(overBoughtLevel, title="Overbought",style=plot.style_circles,color=color.blue)