Hi Steema Techs,
I would like to iterate through all the Values on a chart and Scrape the Bollinger Values for Upper, Lower, and Middle band as well as Date.
Do you have any sample code anywhere that shows how to do this?
I only see X and Y values.
Thanks so much,
Joseph
Iterate through Chart and Scrape Bollinger Upper, Lower, and Middle Band Values???
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Iterate through Chart and Scrape Bollinger Upper, Lower, and Middle Band Values???
Hello Joseph,
Yes, the Bollinger Bands are hidden series, but you can pull the values out with code like this (move the mouse over the top band to get the values):
Here this gives me:
Yes, the Bollinger Bands are hidden series, but you can pull the values out with code like this (move the mouse over the top band to get the values):
Code: Select all
public Form1()
{
InitializeComponent();
Candle series = new Candle(tChart1.Chart);
FastLine funcSeries = new FastLine(tChart1.Chart);
Bollinger function = new Bollinger(tChart1.Chart)
{
Period = 50,
Deviation = 2
};
funcSeries.DataSource = series;
funcSeries.Function = function;
series.FillSampleValues(400);
CursorTool cursor = new CursorTool(tChart1.Chart)
{
Style = CursorToolStyles.Vertical,
FollowMouse = true,
Series = funcSeries
};
cursor.Change += Cursor_Change;
tChart1.Header.Font.Size = 10;
void Cursor_Change(object sender, CursorChangeEventArgs e)
{
if (e.ValueIndex > -1)
{
System.Collections.Generic.List<FastLine> lineSeries = tChart1.Series.OfType<FastLine>().ToList();
tChart1.Header.Text = string.Join("\n", lineSeries.Select(x => $"XValue {DateTime.FromOADate(x.XValues[e.ValueIndex])}, YValue {x.YValues[e.ValueIndex]}"));
}
}
}
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 |