protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
// Define the start and end date for the drawing
DateTime startDate = new DateTime(2017, 05, 01);
DateTime endDate = new DateTime(2017, 05, 21);
// Define the prices and labels for the horizontal lines
double price1 = 141.50;
double price2 = 142.50;
double price3 = 143.50;
// Loop through each bar in the chart and draw the horizontal lines if the bar falls within the date range
for (int i = 0; i < Bars.Count; i++)
{
if (Bars.GetTime(i) >= startDate && Bars.GetTime(i) <= endDate)
{
Draw.HorizontalLine(this, "Line1", false, price1, Brushes.Red, DashStyleHelper.Solid, 1);
Draw.HorizontalLine(this, "Line2", false, price2, Brushes.Green, DashStyleHelper.Solid, 1);
Draw.HorizontalLine(this, "Line3", false, price3, Brushes.Blue, DashStyleHelper.Solid, 1);
}
}
}
Any Ideas on where I need to tweak the code?
THANKS IN ADVANCE,
MD
Comment