This is the modified % bollinger bands oscillator remade by Sylvain Vervoort. It’s using an Heiken Ashi closing price instead of the classic close value with TEMA average. This indicator tend to be more accurate and less choppy for intendifying turning points of the Dow theory by counting reverse oscillation of the curve.
Because of its bounded values, it can be used as an overbought and oversold classical oscillator.
// variables :
// period = 18
// TeAv = 8
// afwh = 1.6
// afwl = 1.6
// afwper = 63
haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2]))/2
haC = ((Open+High+Low+Close)/4 + haOpen + Max(high,haOpen) + Min(low,haOpen)) /4
TMA1 = tema[TeAv](haC)
TMA2 = tema[TeAv](TMA1)
Diff = TMA1-TMA2
ZlHA = TMA1+Diff
percb = (tema[TeAv](ZLHA)+2*STD[period](tema[TeAv](ZLHA))-weightedaverage[period](tema[TeAv](ZLHA))) / (4*STD[period](tema[TeAv](ZLHA)))*100
hi = 50+afwh*STD[afwper](percb)
lo = 50-afwl*STD[afwper](percb)
RETURN percb as "SVE BB %b", hi as "upper band", lo as "lower band", 50 as "middle"
You must be logged in to post a comment.
Now it works. Thanks a lot Nicolas! Here is the full code: // variables : // period = 18 // TeAv = 8 afwh = 1.6 afwl = 1.6 afwper = 63 once haOpen = medianprice if barindex>1 then haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + haOpen[1])/2 endif haC = ((Open+High+Low+Close)/4 + haOpen + Max(high,haOpen) + Min(low,haOpen)) /4 TMA1 = tema[TeAv](haC) TMA2 = tema[TeAv](TMA1) Diff = TMA1-TMA2 ZlHA = TMA1+Diff percb = (tema[TeAv](ZLHA)+2*STD[period](tema[TeAv](ZLHA))-weightedaverage[period](tema[TeAv](ZLHA))) / (4*STD[period](tema[TeAv](ZLHA)))*100 hi = 50+afwh*STD[afwper](percb) lo = 50-afwl*STD[afwper](percb) RETURN percb as "SVE BB %b", hi as "upper band", lo as "lower band", 50 as "middle"
From here: http://traders.com/documentation/feedbk_docs/2010/05/TradersTips.html haOpen = 0.5 * ( AvgPrice + haOpen[1] ) ; So haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2]))/2 is probably wrong. With this formula, if you try to plot haOpen, it is significantly shifted up from the price, which probably does not make sense. But haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2])/4)/2 is probably wrong too... How can we implement a formula which refers to its previous value in ProRealTime?
Thanks!
Hi Nicolas, Something looks odd with haOpen: it seems that /4 is missing in the second part of the formula. Shouldn't we have: haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2])/4)/2 Thanks.