Page 1 of 1
Multi-line series.
Posted: Sat Dec 30, 2006 1:06 pm
by 6924769
I'm not familiar with TeeChart (ActiveX) and I have to do following: In trading application I have to add some indicators which have two or more lines as a result (similar to Bollinger Bands). Moreover some of these indicators must have their own axis (not shared with main price series) and sometimes these lines must have different colors. Problem is that whatever I tried I couldn't make this work and I couldn't find an example how to do this. Can anyone help me with some hints how this can be made.
Posted: Tue Jan 02, 2007 9:03 am
by narcis
Hi Lars67,
To have the lines set to different axes you should read Tutorial 4 - Axis Control. Also could help reading Tutorial 6 - Working with Series.
Also, example of this can be found at the features demo, specially at All Features\Welcome!\Axes.
You'll find the tutorials and features demo at TeeChart's program group.
Posted: Tue Jan 02, 2007 12:25 pm
by 6924769
Setting lines to different axes is not a problem. Main problem is adding multi line series as I wrote in previous post (similar to Bollinger bands which have two lines for one indicator).
Posted: Wed Jan 03, 2007 9:42 am
by narcis
Hi Lars67,
Ok, then you need to create additional series for each band, for example:
Code: Select all
Private Sub Form_Load()
Dim Index As Integer
InitSeries (Index)
For i = 0 To 10
AddSeriesValue Index, Now + i, Rnd, Rnd, Rnd, Rnd
Next
End Sub
Private Sub InitSeries(ByRef CandleIndex As Integer)
CandleIndex = TChart1.AddSeries(scCandle)
TChart1.AddSeries scLine
TChart1.AddSeries scLine
End Sub
Private Sub AddSeriesValue(ByVal Series As Integer, ByVal D As Double, ByVal O As Double, _
ByVal H As Double, ByVal L As Double, ByVal C As Double)
With TChart1
.Series(Series).asCandle.AddCandle D, O, H, L, C
.Series(Series + 1).AddXY D, H + 5, "", clTeeColor
.Series(Series + 2).AddXY D, L - 5, "", clTeeColor
End With
End Sub