Bollinger Function Leaves Bottom Line when Unselected

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
jzarech
Newbie
Newbie
Posts: 46
Joined: Mon Jul 07, 2008 12:00 am

Bollinger Function Leaves Bottom Line when Unselected

Post by jzarech » Mon Dec 11, 2017 3:34 pm

I added a Bollinger function to a candle series on my TChart .Net chart --
When I uncheck the Bollinger series from the chart legend only the Top Bollinger line disappears - but the bottom line remains...
Aren't both Bollinger supposed to disappear?
Thanks in advance for your help.

jzarech
Newbie
Newbie
Posts: 46
Joined: Mon Jul 07, 2008 12:00 am

Re: Bollinger Function Leaves Bottom Line when Unselected

Post by jzarech » Tue Dec 12, 2017 6:12 am

No reply so what I did was improvise --
I debugged and found that after a price is added to a Bollinger Function Series it creates a new unnamed series that has .ShowInLegend set to false and has a title of fastLine2. So after adding data to a Bollinger Series I do this:

line_tcBollingerID.CheckDataSource()
If TChart1.Series(TChart1.Series.Count - 1).ShowInLegend = False Then
TChart1.Series(TChart1.Series.Count - 1).Title = "BollingerI_L"
TChart1.Series(TChart1.Series.Count - 1).ShowInLegend = True
End If

Then I can toggle the series visibility from the legend because both of it's lines are in legend now.

If there's a built-in way I'd like to know.

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: Bollinger Function Leaves Bottom Line when Unselected

Post by Christopher » Fri Dec 15, 2017 9:49 am

Hello,

Apologies for the delay in response to your question. Possibly the easiest 'built-in' way to achieve this is as the following:

Code: Select all

    Candle series;
    FastLine data;
    Bollinger func;

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      series = new Candle(tChart1.Chart);

      func = new Bollinger(tChart1.Chart);
      data = new FastLine(tChart1.Chart);
      data.Function = func;
      data.DataSource = series;

      series.FillSampleValues();
      tChart1.Legend.CheckBoxes = true;
      tChart1.BeforeDraw += TChart1_BeforeDraw;
    }

    private void TChart1_BeforeDraw(object sender, Graphics3D g)
    {
      func.LowBand.Visible = data.Visible;
    }
Best Regards,
Christopher Ireland / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Instructions - How to post in this forum

jzarech
Newbie
Newbie
Posts: 46
Joined: Mon Jul 07, 2008 12:00 am

Re: Bollinger Function Leaves Bottom Line when Unselected

Post by jzarech » Fri Dec 15, 2017 2:48 pm

Ahhhh! - Much better -- thanks so much!
Joseph

Post Reply