NinjaScript > Language Reference >

Drawing

Print this Topic Previous pageReturn to chapter overviewNext page

You can use NinjaScript to draw custom shapes, lines, text and colors on your price and indicator panels from both Indicators and Strategies .

 

Tips

1.Custom graphics for custom indicators can be painted on either the price panel or indicator panel. You could for example have a custom indicator displayed in an indicator panel yet have associated custom graphics painted on the price panel. The "DrawOnPricePanel" property is set to true as default which means that custom graphics will always be painted on the price panel even if the indicator is plotted in a separate panel. If you want your custom graphics to be plotted on the indicator panel, set this property to false in the Initialize() method of your custom indicator.
2.Set unique tag values for each draw object. A common trick is to incorporate the bar number as part of the unique tag identifier. For example, if you wanted to draw a dot that indicated a buying condition above a bar, you could express it:

 DrawDot(CurrentBar.ToString() + "Buy", 0, High[0] + TickSize, Color.ForestGreen)

3. Draw methods will not work if they are called from the Initialize() method.