Drawing a horizontal line on the main chart
Drawing a horizontal line on the main chart
21 Mar 2020, 03:14
Drawing a horizontal line on a chart
I'm using the below code to draw lines on the chart. The code has no pointed errors, but instead of plotting the lines on the main chart, it plots below the chart on a new chart area. How can I create this lines on the main chart ? I've tried most of the codes in the forum and still didn't work for me:
[Parameter(DefaultValue = 100)]
public int StepPips { get; set; }
[Parameter("Cor da linhas", DefaultValue = "White")]
public string corLinha { get; set; }
protected override void Initialize()
{
double max = Bars.HighPrices.Maximum(Bars.HighPrices.Count);
double min = Bars.LowPrices.Minimum(Bars.LowPrices.Count);
double step = Symbol.PipSize * StepPips;
double start = Math.Floor(min / step) * step;
Color colorLine = GetColor();
//ChartArea chrLine = null;
for (double level = start; level <= max + step; level += step)
{
Chart.DrawHorizontalLine("line_" + level, level, colorLine, 1, LineStyle.LinesDots);
}
}
Thanks for help
firemyst
21 Mar 2020, 15:04
You haven't said if "IsOverlay=false" or not
You haven't shown us with your code if this indicator is "IsOverlay" or not.
In a test indicator I have where "IsOverlay = false", the following both work as expected:
@firemyst