Fill area between Bollinger bands

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
vlaho
Newbie
Newbie
Posts: 9
Joined: Wed Jun 25, 2008 12:00 am
Contact:

Fill area between Bollinger bands

Post by vlaho » Thu Oct 16, 2008 2:03 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Oct 16, 2008 2:20 pm

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;
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

vlaho
Newbie
Newbie
Posts: 9
Joined: Wed Jun 25, 2008 12:00 am
Contact:

Post by vlaho » Wed Oct 29, 2008 1:04 pm

Thank you very much!

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

Post Reply