Description
This is extension of Bollinger Bandwidth indicator which also indicates squeeze and bulge as explained by Mr. John Bollinger himself in video:
Squeeze - When blue line of bandwidth touches 20 days low.
Bulge - When blue line of bandwidth touches 20 day high
When in Squeeze, we are entering area of high price movement. When in bulge we have completed high price movement and can expect low volatality.
Check my other indicators:
using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;
namespace cAlgo
{
[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
public class BBSqueezeBulge : Indicator
{
[Parameter("Period", DefaultValue = 20)]
public int Period { get; set; }
[Parameter("SD Weight Coef", DefaultValue = 2)]
public int K { get; set; }
[Parameter("MA Type", DefaultValue = MovingAverageType.Simple)]
public MovingAverageType MaType { get; set; }
[Parameter("High/Low Period", DefaultValue = 20)]
public int HighLowPeriod { get; set; }
[Parameter()]
public DataSeries Source { get; set; }
private BollingerBands _bollingerBands;
[Output("Bandwidth", LineColor = "blue", Thickness = 1)]
public IndicatorDataSeries Bandwidth { get; set; }
[Output("Low", LineColor = "red", Thickness = 3)]
public IndicatorDataSeries Low { get; set; }
[Output("High", LineColor = "green", Thickness = 3)]
public IndicatorDataSeries High { get; set; }
protected override void Initialize()
{
_bollingerBands = Indicators.BollingerBands(Source, Period, K, MaType);
}
public override void Calculate(int index)
{
Bandwidth[index] = (_bollingerBands.Top[index] - _bollingerBands.Bottom[index]) / _bollingerBands.Main[index];
int backCalculationIndex = Math.Min(HighLowPeriod, Bandwidth.Count);
High[index] = Low[index] = Bandwidth[index];
for (int i = 0; i < backCalculationIndex; i++)
{
High[index] = (Bandwidth[index - i] > High[index]) ? Bandwidth[index - i] : High[index];
Low[index] = (Bandwidth[index - i] < Low[index]) ? Bandwidth[index - i] : Low[index];
}
}
}
}
VO
voldemort
Joined on 10.07.2020
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: BBSqueezeBulge.algo
- Rating: 0
- Installs: 2038
- Modified: 13/10/2021 09:54
Note that publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section, please use the Copyright Infringement Notification form to submit a claim.
Comments
Log in to add a comment.
No comments found.