Is it not possible to get and compare TrendChannel using below code? When I tried to debug the program, I am getting draw as NinjaTrader.NinjaScript.DrawingTools.TrendChannel but it is not going inside the condition draw is NinjaTrader.NinjaScript.DrawingTools.TrendChannel and returns false. How do I fix the issue? Additionally, how do I filter in the foreach loop to get only TrendChannel DrawObjects. Thanks
foreach (DrawingTool draw in DrawObjects.ToList())
{
// Finds line objects that are attached globally to all charts of the same instrument
if (draw is DrawingTools.Line)
{
myBuyLine = draw as DrawingTools.Line;
}
else if (draw is NinjaTrader.NinjaScript.DrawingTools.TrendChannel)
{
trendChannel = draw as DrawingTools.TrendChannel;
}
}
Comment