DrawObjects
<< Click to Display Table of Contents >> DrawObjects |
A collection holding all of the drawn chart objects on the chart, for all series. The draw objects can be manually drawn or script generated objects.
Notes:
•When reloading NinjaScript, all objects (including manual drawing tools) are reloaded at the same time. There is no guarantee a manually drawn object will be added to the DrawObjects collection before an indicator starts processing data. •DrawObjects.ToList() is thread safe. DrawObjects collection itself is still dynamic (meaning it updates live) and as a result you can still run the risk of the collection being modified while you try to read it (and thus would see the related C# log entry) However, DrawObjects.ToList() is a snapshot of DrawObjects collection at the time the call is made. •Also please keep in mind that iterating over a large DrawObjects collection could have an impact on performance •Draw objects are disposed (for example on chart closing) after State.Terminated is seen for your custom NinjaScript studies potentially working with those |
A collection of IDrawingTool objects.
DrawObjects
DrawObjects[string tag]
DrawObjects.Count
Finding the draw object of a specific tag |
---|
protected override void OnBarUpdate() |
Get the number of draw objects on a chart |
---|
protected override void OnBarUpdate() |
Looping through the collection to find specific draw objects |
---|
protected override void OnBarUpdate() |
Note: Typecasting as in the example above will not function the same way in a compiled assembly (DLL). For an alternative approach, see the Considerations For Compiled Assemblies page. |