When this horizontal line is moved, its y-value changes. I capture this value and make other calculations with it.
This is my current code:
HorizontalLine HL;
private double HLValue;
.
.
.
Draw.HorizontalLine(this, "My_Horizontal_Line", Close[0], Brushes.Blue)
.
.
.
protected override void OnRender(ChartControl chartControl, ChartScale chartScale)
{
try
{
base.OnRender(chartControl, chartScale);
foreach (Gui.NinjaScript.IChartObject thisObject in ChartPanel.ChartObjects)
{
if(thisObject is NinjaTrader.NinjaScript.DrawingTools.HorizontalLine &&
DrawObjects["My_Horizontal_Line"] as DrawingTools.HorizontalLine != null )
{
HL = thisObject as NinjaTrader.NinjaScript.DrawingTools.HorizontalLine;
HLValue = HL.StartAnchor.Price;
}
}
I would appreciate it if you could share a way to find this line and assign HL to it.
Thanks.

Comment