Page 1 of 1
Bollinger Function Leaves Bottom Line when Unselected
Posted: Mon Dec 11, 2017 3:34 pm
by 13049545
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.
Re: Bollinger Function Leaves Bottom Line when Unselected
Posted: Tue Dec 12, 2017 6:12 am
by 13049545
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.
Re: Bollinger Function Leaves Bottom Line when Unselected
Posted: Fri Dec 15, 2017 9:49 am
by Christopher
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;
}
Re: Bollinger Function Leaves Bottom Line when Unselected
Posted: Fri Dec 15, 2017 2:48 pm
by 13049545
Ahhhh! - Much better -- thanks so much!
Joseph