Page 1 of 1

Fill area between Bollinger bands

Posted: Thu Oct 16, 2008 2:03 pm
by 13049466
Hi,

How can I fill the area between Bollinger bands with some color or gradient? Something like Area chart style, but between two curves.

This is my code for drawing bollinger:

Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1);
Steema.TeeChart.Functions.Bollinger function = new Steema.TeeChart.Functions.Bollinger(tChart1);

string[] parameters = indicator.Parameters.Split(';');

function.Period = double.Parse(parameters[0]);
function.Deviation = double.Parse(parameters[1]);

line.Function = function;
line.DataSource = candleSeries1;
line.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
line.Brush.Color = indicator.IndicatorColor;
line.CheckDataSource();

Thanks,

Goran

Posted: Thu Oct 16, 2008 2:20 pm
by narcis
Hi Goran,

Yes, you can use SeriesBand tool for that, for example:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			Steema.TeeChart.Styles.Candle candleSeries1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);

			candleSeries1.FillSampleValues();

			Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			Steema.TeeChart.Functions.Bollinger function = new Steema.TeeChart.Functions.Bollinger(tChart1.Chart);

			//string[] parameters = indicator.Parameters.Split(';');

			//function.Period = double.Parse(parameters[0]);
			//function.Deviation = double.Parse(parameters[1]);

			line.Function = function;
			line.DataSource = candleSeries1;
			line.VertAxis = Steema.TeeChart.Styles.VerticalAxis.Right;
			//line.Brush.Color = indicator.IndicatorColor;
			line.CheckDataSource();

			Steema.TeeChart.Tools.SeriesBandTool seriesBand1 = new Steema.TeeChart.Tools.SeriesBandTool(tChart1.Chart);
			
			seriesBand1.Series = tChart1[tChart1.Series.Count - 2];
			seriesBand1.Series2 = tChart1[tChart1.Series.Count - 1];
			seriesBand1.Gradient.Visible = true;
			seriesBand1.Gradient.Transparency = 50;
		}

Posted: Wed Oct 29, 2008 1:04 pm
by 13049466
Thank you very much!

I downloaded the latest version because mine did not include SeriesBand tool. Now it works perfectly.