NinjaScript > Language Reference > Indicator >

Lines

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
A collection holding all of the Line objects that define the visualization characteristics oscillator lines of the indicator.

 

Property Value

A collection of Line objects.

 

Syntax

Lines[int index]

 

 

Examples

// Initialize method of a custom indicator
protected override void Initialize()
{

    // Lines are added to the Lines collection in order
    Add(new Line(Color.Gray, 30, "Lower")); // Stored in Lines[0]
    Add(new Line(Color.Gray, 70, "Upper")); // Stored in Lines[1]
}

 

// Dynamically change the upper line's color and thickness based on the indicator value

protected override void OnBarUpdate()

{

    if (Value[0] > 70)

         Lines[1].Pen = new Pen(Color.Blue, 3);

    else

         Lines[1].Pen = new Pen(Color.Gray, 1);

}