Series0 is a candle series.
Series1 is a Bollinger band function based on the series0 candles.
The bollinger band produces both an upper and lower band, 2 values.
I would like to click on a candle and return both the bollinger band y values.
What does the code look like to find these values based on the Y axis?
I couldn't seem to find this in a forum search. Maybe there is a example in the user group but I couldn't identify it.
Thanks for your help.
David
using V6.0.0.6 and VB6
get Bollinger band values from mouse click
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
You can use something like:
The obtained Bolinger Bands Y values will depend on the period you set for that series. If you want to get the Bollinger Bands Y values for the X value you clicked then you will have to obtain it using the candle X date value.
You can use something like:
Code: Select all
Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim clicked As Long
clicked = TChart1.Series(SeriesIndex).GetMousePoint
Label3.Caption = "Point:" + Str(clicked)
Label1.Caption = "Bolinger Band1 Y: " + Str(TChart1.Series(1).YValues.Value(clicked))
Label2.Caption = "Bolinger Band2 Y: " + Str(TChart1.Series(2).YValues.Value(clicked))
End Sub
Best Regards,
Narcís Calvet / 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 |
Thanks for your response.narcis wrote:Hi David,
You can use something like:
The obtained Bolinger Bands Y values will depend on the period you set for that series. If you want to get the Bollinger Bands Y values for the X value you clicked then you will have to obtain it using the candle X date value.Code: Select all
Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long) Dim clicked As Long clicked = TChart1.Series(SeriesIndex).GetMousePoint Label3.Caption = "Point:" + Str(clicked) Label1.Caption = "Bolinger Band1 Y: " + Str(TChart1.Series(1).YValues.Value(clicked)) Label2.Caption = "Bolinger Band2 Y: " + Str(TChart1.Series(2).YValues.Value(clicked)) End Sub
When I use the Bollinger band function for series 1, it creates 2 bands on the chart. I'm pretty sure they are not split into 2 series as in your example. They are 2 values in series1 - the regular and the lower band.
I also don't want to use the onclickseries. I want to make this a part of my existing onmousedown event. This means I will have an X value when I push the mouse. Based on this, I would like to get the upper and lower Bollinger band Y values for that given x. These values are somehow associated with Series 1 in my example.
I'm just not sure how to access the value points.
Thanks, David
I got it working once I figured out how to access the lower band.
ebbptr is the pointer for the Xvalue factoring in the null values at the beginning.
Thanks for your help.
David
Code: Select all
MultiChart.Series(4).FunctionType.asBollinger.LowBand.YValues.Value(ebbPtr)
Thanks for your help.
David