Scroll Point and Figure
Posted: Tue Jun 28, 2011 9:57 pm
I am using data stored in a CandleSeries as the source for a Point and Figure function. I need to know how to find out how many columns of X's and O's are returned in the P&F chart. The PFSeries.XValues.Count returns the number of items in the underlying data, not the results of the study.
Here is a chunk of code that will create a sample of the chart I am working with. When you create the chart you can see how the P&F chart is crammed into an unreadable area. I have found that I can set the horizontal and vertical axes to spread it out as needed. I just do not know how to quickly find the P&F column count and the ranges of data in each of the columns. Basically, I will need to be able to calculate both horzontal and vertical axes max and min values so I can scroll a useful chart programatically, meaning I need to know the number of bars and then the visible data range as I scroll it.
Thank you very much for your assistance!
Dave R.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TChart1.Series.Clear()
TChart1.Dock = DockStyle.Fill
TChart1.Aspect.View3D = False
TChart1.Header.Visible = False
TChart1.Legend.Visible = False
TChart1.Axes.Left.Visible = True
TChart1.Axes.Right.Visible = True
TChart1.Axes.Top.Visible = False
TChart1.Axes.Bottom.Visible = True
TChart1.Panel.BorderRound = 0
TChart1.Panel.Transparency = 100
TChart1.Panel.Transparent = True
TChart1.Walls.Back.ImageMode = Steema.TeeChart.Drawing.ImageMode.Normal
TChart1.Panning.Allow = ScrollModes.Both
TChart1.Panning.MouseButton = Windows.Forms.MouseButtons.Right
TChart1.Panel.MarginUnits = PanelMarginUnits.Pixels
TChart1.Panel.MarginLeft = 60
TChart1.Panel.MarginRight = 60
TChart1.Panel.MarginBottom = 13
TChart1.Page.MaxPointsPerPage = 150
TChart1.AutoRepaint = True
Dim GreenAxis As Steema.TeeChart.Axis
Dim BlueAxis As Steema.TeeChart.Axis
GreenAxis = New Steema.TeeChart.Axis(TChart1.Chart)
GreenAxis.OtherSide = False
GreenAxis.AxisPen.Color = Color.Green
GreenAxis.StartPosition = 0
GreenAxis.EndPosition = 100
GreenAxis.Automatic = True
Me.TChart1.Axes.Custom.Add(GreenAxis)
BlueAxis = New Steema.TeeChart.Axis(TChart1.Chart)
BlueAxis.OtherSide = True
BlueAxis.AxisPen.Color = Color.Blue
BlueAxis.StartPosition = 0
BlueAxis.EndPosition = 100
BlueAxis.Automatic = True
Me.TChart1.Axes.Custom.Add(BlueAxis)
Dim CandleSeries1 As New Steema.TeeChart.Styles.Candle(TChart1.Chart)
CandleSeries1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore
CandleSeries1.Style = Styles.CandleStyles.CandleBar
CandleSeries1.XValues.DateTime = False
CandleSeries1.FillSampleValues(150)
CandleSeries1.CustomVertAxis = GreenAxis
CandleSeries1.UpCloseColor = Color.Blue
TChart1.Series.Add(CandleSeries1)
CandleSeries1.Active = False
GreenAxis.Visible = False
Dim PFLine As New Steema.TeeChart.Styles.PointFigure(TChart1.Chart)
TChart1.Series.Add(PFLine)
PFLine.DataSource = CandleSeries1
PFLine.YValues.DataMember = "Close"
PFLine.BoxSize = 5
PFLine.ReversalAmount = 3
PFLine.HorizAxis = Styles.HorizontalAxis.Bottom
PFLine.CustomVertAxis = BlueAxis
PFLine.CloseValues = CandleSeries1.CloseValues
PFLine.ColorEach = False
PFLine.CheckDataSource()
TChart1.Refresh()
Dim ddd As Double = PFLine.XValues.Count 'This is the wrong data.
End Sub
Here is a chunk of code that will create a sample of the chart I am working with. When you create the chart you can see how the P&F chart is crammed into an unreadable area. I have found that I can set the horizontal and vertical axes to spread it out as needed. I just do not know how to quickly find the P&F column count and the ranges of data in each of the columns. Basically, I will need to be able to calculate both horzontal and vertical axes max and min values so I can scroll a useful chart programatically, meaning I need to know the number of bars and then the visible data range as I scroll it.
Thank you very much for your assistance!
Dave R.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TChart1.Series.Clear()
TChart1.Dock = DockStyle.Fill
TChart1.Aspect.View3D = False
TChart1.Header.Visible = False
TChart1.Legend.Visible = False
TChart1.Axes.Left.Visible = True
TChart1.Axes.Right.Visible = True
TChart1.Axes.Top.Visible = False
TChart1.Axes.Bottom.Visible = True
TChart1.Panel.BorderRound = 0
TChart1.Panel.Transparency = 100
TChart1.Panel.Transparent = True
TChart1.Walls.Back.ImageMode = Steema.TeeChart.Drawing.ImageMode.Normal
TChart1.Panning.Allow = ScrollModes.Both
TChart1.Panning.MouseButton = Windows.Forms.MouseButtons.Right
TChart1.Panel.MarginUnits = PanelMarginUnits.Pixels
TChart1.Panel.MarginLeft = 60
TChart1.Panel.MarginRight = 60
TChart1.Panel.MarginBottom = 13
TChart1.Page.MaxPointsPerPage = 150
TChart1.AutoRepaint = True
Dim GreenAxis As Steema.TeeChart.Axis
Dim BlueAxis As Steema.TeeChart.Axis
GreenAxis = New Steema.TeeChart.Axis(TChart1.Chart)
GreenAxis.OtherSide = False
GreenAxis.AxisPen.Color = Color.Green
GreenAxis.StartPosition = 0
GreenAxis.EndPosition = 100
GreenAxis.Automatic = True
Me.TChart1.Axes.Custom.Add(GreenAxis)
BlueAxis = New Steema.TeeChart.Axis(TChart1.Chart)
BlueAxis.OtherSide = True
BlueAxis.AxisPen.Color = Color.Blue
BlueAxis.StartPosition = 0
BlueAxis.EndPosition = 100
BlueAxis.Automatic = True
Me.TChart1.Axes.Custom.Add(BlueAxis)
Dim CandleSeries1 As New Steema.TeeChart.Styles.Candle(TChart1.Chart)
CandleSeries1.TreatNulls = Steema.TeeChart.Styles.TreatNullsStyle.Ignore
CandleSeries1.Style = Styles.CandleStyles.CandleBar
CandleSeries1.XValues.DateTime = False
CandleSeries1.FillSampleValues(150)
CandleSeries1.CustomVertAxis = GreenAxis
CandleSeries1.UpCloseColor = Color.Blue
TChart1.Series.Add(CandleSeries1)
CandleSeries1.Active = False
GreenAxis.Visible = False
Dim PFLine As New Steema.TeeChart.Styles.PointFigure(TChart1.Chart)
TChart1.Series.Add(PFLine)
PFLine.DataSource = CandleSeries1
PFLine.YValues.DataMember = "Close"
PFLine.BoxSize = 5
PFLine.ReversalAmount = 3
PFLine.HorizAxis = Styles.HorizontalAxis.Bottom
PFLine.CustomVertAxis = BlueAxis
PFLine.CloseValues = CandleSeries1.CloseValues
PFLine.ColorEach = False
PFLine.CheckDataSource()
TChart1.Refresh()
Dim ddd As Double = PFLine.XValues.Count 'This is the wrong data.
End Sub