Smoothing The Bollinger %b
In his article “Smoothing The Bollinger %b”, Sylvain Vervoot has investigated the variation of the Bollinger bands indicator to find clear turning points that will help traders identify entry and exit points.
Using Tradecision’s Function Builder, one needs to create the TEMA function:
TEMA function:
function (Price:Numeric =
C, Length:Numeric = 9): Numeric;
return (3*EMA(Price,Length) -
3*EMA(EMA(Price,Length),Length)) +
EMA(EMA(EMA(Price,Length),Length),Length);
Using Tradecision’s Indicator Builder, one needs to create the SMOOTHED BOLLINGER % B, SMOOTHED BOLLINGER % B TOP and SMOOTHED BOLLINGER % B BOTTOM indicators:
SMOOTHED BOLLINGER %B indicator:
input
period:"%b period:",18,1,100;
TeAv:"Tema average:",8,1,30;
afwh:"Standard deviation high",1.6,0.1,5;
afwl:"Standard deviation low",1.6,0.1,5;
afwper:"Standard deviation period",63,1,200;
end_input
var
denom:=0;
WeightPrice:=0;
haOpen:=0;
haC:=0;
TMA1:= 0;
TMA2:= 0;
Diff:= 0;
ZlHA:= 0;
percb:=0;
end_var
if HISTORYSIZE < 2 then return 0;
WeightPrice:=(O\1\ + H\1\ + L\1\ + C\1\) / 4;
haOpen:=(WeightPrice + WeightPrice\1\) / 2;
haC:=((O + H + L + C) / 4 +
haOpen + Max(H, haOpen) +
Min(L, haOpen)) / 4;
TMA1:= TEMA(haC,TeAv) ;
TMA2:= TEMA(TMA1,TeAv);
Diff:=TMA1 - TMA2;
ZlHA:=TMA1 + Diff;
denom:= 4 * StdDev(TEMA(ZLHA, TeAv), period);
if denom = 0 then return inf;
percb:=(TEMA(ZLHA, TeAv) +
2 * StdDev(TEMA(ZLHA, TeAv), period) -
WMA(TEMA(ZLHA, TeAv), period)) / denom * 100;
return percb;
SMOOTHED BOLLINGER %B TOP indicator:
input
period:"%b period:",18,1,100;
TeAv:"Tema average:",8,1,30;
afwh:"Standard deviation high",1.6,0.1,5;
afwl:"Standard deviation low",1.6,0.1,5;
afwper:"Standard deviation period",63,1,200;
end_input
var
denom:=0;
WeightPrice:=0;
haOpen:=0;
haC:=0;
TMA1:= 0;
TMA2:= 0;
Diff:= 0;
ZlHA:= 0;
percb:=0;
end_var
if HISTORYSIZE < 2 then return 0;
WeightPrice:=(O\1\ + H\1\ + L\1\ + C\1\) / 4;
haOpen:=(WeightPrice + WeightPrice\1\) / 2;
haC:=((O + H + L + C) / 4 +
haOpen + Max(H, haOpen) +
Min(L, haOpen)) / 4;
TMA1:= TEMA(haC,TeAv) ;
TMA2:= TEMA(TMA1,TeAv);
Diff:=TMA1 - TMA2;
ZlHA:=TMA1 + Diff;
denom:= 4 * StdDev(TEMA(ZLHA, TeAv), period);
if denom = 0 then return inf;
percb:=(TEMA(ZLHA, TeAv) +
2 * StdDev(TEMA(ZLHA, TeAv), period) -
WMA(TEMA(ZLHA, TeAv), period)) / denom * 100;
return 50 + afwh * StdDev(percb, afwper);
SMOOTHED BOLLINGER %B BOTTOM indicator:
input
period:"%b period:",18,1,100;
TeAv:"Tema average:",8,1,30;
afwh:"Standard deviation high",1.6,0.1,5;
afwl:"Standard deviation low",1.6,0.1,5;
afwper:"Standard deviation period",63,1,200;
end_input
var
denom:=0;
WeightPrice:=0;
haOpen:=0;
haC:=0;
TMA1:= 0;
TMA2:= 0;
Diff:= 0;
ZlHA:= 0;
percb:=0;
end_var
if HISTORYSIZE < 2 then return 0;
WeightPrice:=(O\1\ + H\1\ + L\1\ + C\1\) / 4;
haOpen:=(WeightPrice + WeightPrice\1\) / 2;
haC:=((O + H + L + C) / 4 +
haOpen + Max(H, haOpen) +
Min(L, haOpen)) / 4;
TMA1:= TEMA(haC,TeAv) ;
TMA2:= TEMA(TMA1,TeAv);
Diff:=TMA1 - TMA2;
ZlHA:=TMA1 + Diff;
denom:= 4 * StdDev(TEMA(ZLHA, TeAv), period);
if denom = 0 then return inf;
percb:=(TEMA(ZLHA, TeAv) +
2 * StdDev(TEMA(ZLHA, TeAv), period) -
WMA(TEMA(ZLHA, TeAv), period)) / denom * 100;
return 50 - afwh * StdDev(percb, afwper);
|