The “WaveTrend Ribbon” indicator allows the detection of critical overbought and oversold moments. This article delves into how this indicator works, how to set it up, and how to interpret its signals for more informed trading decisions.
The “WaveTrend Ribbon” is a technical indicator that combines several analytical methods to provide a clear view of market trends and potential reversal points. Below, we break down its key components:
Configuring the “WaveTrend Ribbon” involves adjusting several parameters:
The “WaveTrend Ribbon” is a versatile indicator that, when used correctly, can be a valuable tool in any trader’s arsenal.
//-------------------------------------------------------------------------------//
//PRC_WaveTrend Ribbon
//version = 0
//17.04.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
//-------------------------------------------------------------------------------//
//-----Inputs--------------------------------------------------------------------//
//-----WaveTrend
n1=10//Channel length
n2=21//Average length
oblevel=2//Overbought Z-score level
oslevel=-2//Oversold Z-score level
lengthZ=20//Length for Z-score Calculation
hmaLength=12//HMA Length for Z-score Smoothing
wmaLength=3//WMA Length for Z-Score
//-----Divergences
plotdivergences=1//show bullish and bearish divergences
plothiddendiv=1//show hidden bullish and bearish divergences
//-----Pivots
lbR=1//lookback Right
lbL=20//lookback Left
//-------------------------------------------------------------------------------//
//-----WaveTrend Calculation-----------------------------------------------------//
ap=(high+low+close)/3
esa=average[n1,1](ap)
d=average[n1,1](abs(ap-esa))
ci=(ap-esa)/(0.0015*d)
tci=average[n2,1](ci)
//-------------------------------------------------------------------------------//
//-----Z-Score Calculation-------------------------------------------------------//
meanWT=average[lengthZ](tci)
stdDevWT=std[lengthZ](tci)
zScoreaux=(tci-meanWT)/stdDevWT
zScore=hullaverage[hmaLength](zScoreaux)
zma=weightedaverage[wmaLength](zScore)
//-------------------------------------------------------------------------------//
//-----Colors--------------------------------------------------------------------//
if zScore > 0 then
r=0
g=255
b=187
else
r=255
g=17
b=0
endif
colorbetween(zScore,zma,r,g,b,70)
//-------------------------------------------------------------------------------//
//-----Overbought/Oversold conditions--------------------------------------------//
obCondition = zScore > obLevel
osCondition = zScore < osLevel
if obCondition then
backgroundcolor(255,17,0,30)
elsif osCondition then
backgroundcolor(0,255,187,30)
endif
if obCondition and zScore[1]>zScore then
drawtext("▼",barindex,3)coloured("red")
elsif osCondition and zScore[1]<zScore then
drawtext("▲",barindex,-3)coloured("green")
elsif zscore crosses over zma or zscore crosses under zma then
drawpoint(barindex,zma,2)coloured(r,g,b)
endif
//-------------------------------------------------------------------------------//
//-----Pivots High-Low Z-Score---------------------------------------------------//
osc=zScore
//-----pivots low
if osc > osc[lbR] and lowest[lbR](osc) > osc[lbR] and osc[lbR] < lowest[lbL](osc)[lbR+1] then
$pl[z+1] = osc[lbR]
$plx[z+1] = barindex[lbR]
$priceL[z+1] = low[lbR]
//drawpoint(barindex[lbR],osc[lbR],2)coloured("blue",50)
z = z + 1
endif
//-----pivots high
if osc < osc[lbR] and highest[lbR](osc)<osc[lbR] and osc[lbR]>highest[lbL](osc)[lbR+1] then
$ph[t+1]=osc[lbR]
$phx[t+1]=barindex[lbR]
$priceH[t+1]=high[lbR]
//drawpoint(barindex[lbR],osc[lbR],2)coloured("blue",50)
t=t+1
endif
//-------------------------------------------------------------------------------//
//-----Regular Bullish
oscHL = $pl[z] > $pl[max(0,z-1)] and $plx[max(0,z)] - $plx[max(0,z-1)]<=80
priceLL = low[lbR] < $priceL[max(0,z-1)]
bullCond = priceLL and oscHL and isset($pl[z])
//-----Hidden Bullish
oscLL = $pl[z] < $pl[max(0,z-1)] and $plx[max(0,z)] - $plx[max(0,z-1)]<=80
priceHL = low[lbR] > $priceL[max(0,z-1)]
hiddenbullCond = priceHL and oscLL and isset($pl[z])
//-----Regular Bearish
oscLH = $ph[t] < $ph[max(t-1,0)] and $phx[t] - $phx[max(0,t-1)]<=80
priceHH = high[lbR] > $priceH[max(0,t-1)]
bearCond = priceHH and oscLH and isset($ph[t])
//-----HiddenBearish
oscHH = $ph[t] > $ph[max(t-1,0)] and $phx[t] - $phx[max(0,t-1)]<=80
priceLH = high[lbR] < $priceH[max(0,t-1)]
hiddendbearCond = priceLH and oscHH and isset($ph[t])
if z<>z[1] and bullCond and plotdivergences then
drawsegment($plx[max(0,z-1)],$pl[max(0,z-1)],$plx[z],$pl[z])coloured("green")style(line,2)
drawtext("Bull",$plx[z],$pl[z]-tr)coloured("green")
elsif z<>z[1] and hiddenbullCond and plothiddendiv then
drawsegment($plx[max(0,z-1)],$pl[max(0,z-1)],$plx[z],$pl[z])coloured("green",50)
drawtext("H.Bull",$plx[z],$pl[z]-tr)coloured("green",80)
elsif t<>t[1] and bearCond and plotdivergences then
drawsegment($phx[max(0,t-1)],$ph[max(0,t-1)],$phx[t],$ph[t])coloured("red")style(line,2)
drawtext("Bear",$phx[t],$ph[t]+tr)coloured("red")
elsif t<>t[1] and hiddendbearCond and plothiddendiv then
drawsegment($phx[max(0,t-1)],$ph[max(0,t-1)],$phx[t],$ph[t])coloured("red",50)
drawtext("H.Bear",$phx[t],$ph[t]+tr)coloured("red",80)
endif
//-------------------------------------------------------------------------------//
//-------------------------------------------------------------------------------//
return zScore as "Z-Score"coloured(r,g,b)style(line,1),zma as "Avg Z-Score"coloured(r,g,b)style(line,1),0 as "0" coloured("gray"),obLevel as "Overbought"coloured(255,17,0)style(dottedline),osLevel as "Overshold"coloured(0,255,187)style(dottedline)