"Draw.PathTool(
NinjaScriptBase owner,
string tag,
bool isAutoScale,
int anchor1BarsAgo,
double anchor1Y,
int anchor2BarsAgo,
double anchor2Y,
int anchor3BarsAgo,
double anchor3Y,
int anchor4BarsAgo,
double anchor4Y)"
and everything works fine if I draw them normally, but then I tried drawing them using OnRender and a "ChartBars.ToIndex; ChartBars.FromIndex"-loop to increase performance.
All of a sudden I'm getting "Object reference not set to an instance of an object".
When debugging, the value that is null is PathTool ChartAnchors, but all the other values are there barsAgo, price etc.
I then tried with inserting a list of anchors with
"Draw.PathTool(
NinjaScriptBase owner,
string tag,
bool isAutoScale,
List<ChartAnchor> chartAnchors,
Brush brush,
DashStyleHelper dashStyle)" and everything draws, but unfortunately ChartAnchor only accepts DateTime and not BarsAgo.
Since I'm using Renko bars, the Time value is not always correct for the bars, meaning sometimes when price has moved very fast, the bars are drawn with the same Time, but different barIndex. This causes the drawn lines to be off by several bars as seen in the picture.
From experience I've learned that Time is generally not a good value too use when drawing on charts that have bar types such as Renkos and other time independent charts. I've tried using Tick Replay but there isn't any difference.
Any suggestions on how I can solve this? A new feature to be able to create a PathTool list of chartAnchors with BarsAgo values or even barIndex would make things lots easier.
Comment