Issue with CCI Function?
Posted: Thu Dec 23, 2010 8:46 pm
I have a basic chart going with an OHLC candle series and volume. If I add a pane with a CCI study in it I always get some odd lines at the end of the CCI chart. Following is a good example. You can see 4 CCI studies. They are all created identically with the period set to 20, the datasource set to Candel1, and the datamember set to "Close". The difference between the charts is when they were created. Each chart was added to the overall chart a few minutes after the previous one. Notice the big drop that occurs in each chart. As time goes by that drop changes in its position.
[img] [/img]
The code that was used to create it is:
Dim NewAxis As Steema.TeeChart.Axis = New Steema.TeeChart.Axis(TChart1.Chart)
NewAxis.OtherSide = True
NewAxis.AxisPen.Color = Color.Green
NewAxis.StartPosition = 80 '+ 2
NewAxis.EndPosition = 100
NewAxis.Automatic = True
NewAxis.Visible = True
Dim CCITag As String = "CCI-" & GetRandomID()
NewAxis.Tag = CCITag
Me.TChart1.Axes.Custom.Add(NewAxis)
Dim line1 As New Steema.TeeChart.Styles.Line(TChart1.Chart)
Dim CCI1 As New Steema.TeeChart.Functions.CCIFunction
line1.Function = CCI1
CCI1.Tag = CCITag
Dim eCnt As Integer = 0
line1.DataSource = CandleSeries1
Dim cst As Double = CCI1.Constant
line1.YValues.DataMember = DT.Rows(0).Item("Column")
line1.Function.Period = DT.Rows(0).Item("Period")
line1.Function.PeriodAlign = Functions.PeriodAligns.Last
line1.Function.PeriodStyle = Functions.PeriodStyles.NumPoints
Dim c As Color = DT.Rows(0).Item("Color")
line1.Color = c
line1.CustomVertAxis = NewAxis
Dim DashStyle As String = DT.Rows(0).Item("Style")
Call SetLineStyle(line1, DashStyle)
Dim pWidth As Integer = DT.Rows(0).Item("Width")
line1.LinePen.Width = pWidth
line1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
AddHandler line1.MouseEnter, AddressOf ChartSeries_MouseEnter
AddHandler line1.MouseLeave, AddressOf ChartSeries_MouseLeave
line1.CheckDataSource()
line1.Tag = CCITag
TChart1.Invalidate()
Can you confirm that the CCI function is drawing properly? Or, if there is something incorrect about the way I create it, please let me know.
[img] [/img]
The code that was used to create it is:
Dim NewAxis As Steema.TeeChart.Axis = New Steema.TeeChart.Axis(TChart1.Chart)
NewAxis.OtherSide = True
NewAxis.AxisPen.Color = Color.Green
NewAxis.StartPosition = 80 '+ 2
NewAxis.EndPosition = 100
NewAxis.Automatic = True
NewAxis.Visible = True
Dim CCITag As String = "CCI-" & GetRandomID()
NewAxis.Tag = CCITag
Me.TChart1.Axes.Custom.Add(NewAxis)
Dim line1 As New Steema.TeeChart.Styles.Line(TChart1.Chart)
Dim CCI1 As New Steema.TeeChart.Functions.CCIFunction
line1.Function = CCI1
CCI1.Tag = CCITag
Dim eCnt As Integer = 0
line1.DataSource = CandleSeries1
Dim cst As Double = CCI1.Constant
line1.YValues.DataMember = DT.Rows(0).Item("Column")
line1.Function.Period = DT.Rows(0).Item("Period")
line1.Function.PeriodAlign = Functions.PeriodAligns.Last
line1.Function.PeriodStyle = Functions.PeriodStyles.NumPoints
Dim c As Color = DT.Rows(0).Item("Color")
line1.Color = c
line1.CustomVertAxis = NewAxis
Dim DashStyle As String = DT.Rows(0).Item("Style")
Call SetLineStyle(line1, DashStyle)
Dim pWidth As Integer = DT.Rows(0).Item("Width")
line1.LinePen.Width = pWidth
line1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.DoNotPaint
AddHandler line1.MouseEnter, AddressOf ChartSeries_MouseEnter
AddHandler line1.MouseLeave, AddressOf ChartSeries_MouseLeave
line1.CheckDataSource()
line1.Tag = CCITag
TChart1.Invalidate()
Can you confirm that the CCI function is drawing properly? Or, if there is something incorrect about the way I create it, please let me know.