I'm trying to create a new class to extend the DrawObjects.Line class using inheritance. Here's the code for the extended class:
public enum TrendlineType { PrimaryTrend, PrimaryChannel, SecondaryTrend, SecondaryChannel, CounterTrend, CounterChannel } public class Trendline : NinjaTrader.NinjaScript.DrawingTools.Line { public Trendline() : base() { } public TrendlineType Type() { return TrendlineType.PrimaryTrend; } }
Unable to cast object of type 'NinjaTrader.NinjaScript.DrawingTools.Line' to type 'Trendline'.
NinjaTrader.NinjaScript.DrawingTools.Line objLine = objTool as DrawingTools.Line; Trendline objTrendline = (Trendline)new DrawingTools.Line(); // This raises a casting error
Thank you,
Ryan
Comment