I can produce a tick counter which gives a text display but I have no idea how to write this info at bar close to a text file and then read it back so that I can get a historical type display.
I found this somewhere and just manipulated it a little.
public override void Plot(Graphics graphics, Rectangle bounds, double min, double max) { if (Bars == null) return; // Recalculate the proper string size should the chart control object font and axis color change if (textBrush.Color != ChartControl.AxisColor || textFont != ChartControl.Font) { textBrush.Color = ChartControl.AxisColor; textFont = ChartControl.Font; SizeF size = graphics.MeasureString((CountDown ? "Ticks remaining = %" : "Tick count = %") + Bars.Period.Value, textFont); textWidth = size.Width + 5; textHeight = size.Height + 5; SizeF noTickSize = graphics.MeasureString("Tick Counter interval", textFont); noTickTextWidth = noTickSize.Width + 5; noTickTextHeight = noTickSize.Height + 5; } // Plot the tick count message to the lower right hand corner of the chart if (Bars.Period.Id == PeriodType.Tick) { double tickCount = ShowPercent ? CountDown ? (1 - Bars.PercentComplete) * 100 : Bars.PercentComplete * 100 : CountDown ? Bars.Period.Value - Bars.TickCount : Bars.TickCount; graphics.DrawString((CountDown ? " Ticks remaining = " + tickCount : "Tick count = " + tickCount) + (ShowPercent ? "%" : ""), ChartControl.Font, textBrush, bounds.X + bounds.Width - textWidth, bounds.Y + bounds.Height - textHeight, stringFormat); } else graphics.DrawString(Bars.TickCount.ToString(), ChartControl.Font, textBrush, bounds.X + bounds.Width - noTickTextWidth, bounds.Y + bounds.Height - noTickTextHeight, stringFormat); }
Any help much appreciated.
Comment