IsVisible

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Common >

IsVisible

Previous page Return to chapter overview Next page

Definition

Determines if the current NinjaScript object should be visible on the chart.  When an object's IsVisible property is set to false, the object will NOT be displayed on the chart and will not be calculated to save resources.

 

Note:   Strategies intentionally contain no IsVisible property.

 

Property Value

A bool value when true will be displayed on the chart; otherwise false; default value is true.

 

Syntax

IsVisible

 

Examples

ns

2

3

4

5

6

7

8

9

10

11

12

13

public override void OnRender(ChartControl chartControl, ChartScale chartScale)

{

// only render the currently as visible selected price levels in our NinjaScript drawing object

foreach (PriceLevel priceLevel in PriceLevels.Where(pl => pl.IsVisible && pl.Stroke != null)

 {

 Vector startDir                = priceLevel.Value / 100 * (startPoint2 - startPoint);

 Vector lineVector                = endPoint - startPoint;

 Point newStartPoint                = new Point(startPoint.X + startDir.X, startPoint.Y + startDir.Y);

 Point newEndPoint                = new Point(newStartPoint.X + lineVector.X, newStartPoint.Y + lineVector.Y);

 

 RenderTarget.DrawLine(newStartPoint.ToVector2(), newEndPoint.ToVector2(), priceLevel.Stroke.BrushDX, priceLevel.Stroke.Width, priceLevel.Stroke.StrokeStyle);

 }

}