I am an experienced programmer, but I am new to Ninjatrader development and I am trying to add additional Text-Boxes to the newly added "Path" drawing tool. An example mock-up of what I want to achieve can be seen here.
So I have created my own drawing tool and basically copied the code of the Path tool over to my new tool and changed it's name appropriately. Everything is working fine so far. My new drawing tool behaves exactly like the Path tool and works fine.
Now I wanted to add the automatic drawing of the text to it by using one of the Draw.Text constructors.
However, the Text class needs an 'Owner' parameter, and since DrawingTools are apparently not derived from NinjaScriptBase, I was trying to just pass along the owner of my own drawing tool by using this.DrawnBy
This is the exact line of code that I am using:
Draw.Text(this.DrawnBy, "Test", dataPoint.Price.ToString("0.00000"), 10, dataPoint.Price);
After some digging, I found out that this.DrawnBy is always NULL.
So here are my questions:
- Why is the DrawnBy attribute of my DrawingTool never set?
- Is there another way to get an appropriate NinjaScriptBase reference from within a drawing tool?
- Is there any easier way to effectively chain two DrawingTools together so I can combine their functionality (just like I want to do with this tool)
- Any general guidance in what I should do to achieve this?
I appreciate any help you can provide
(Also a short hint: Draw.Text seems to be the only DrawingTool from the Draw-Class that does NOT check weather Owner is NULL or not in it's Core constructor. All other classes check for it. Probably a tiny oversight?)
Comment