I'm trying to implement a user property based on an expandable derived Stroke object (e.g. LegendStroke) in order to hide the Stroke object's DashStyleHelper and Width properties from NinjaTrader's indicators UI. A user property based on a non-derived Stroke object works fine (e.g. expandable/collapsible, usable values, etc.) however replacing that user property's type (Stroke) with the custom derived type (LegendStroke) results in a "NinjaTrader.Gui.Tools.ObjectDialogViewMode'1.OnAd dItem(Object selected)..." abort/retry/ignore message box and if ignored raises an "Unhandled exception: Non-static method required a target" error. Sample code is below, of which I tried commenting out the [Browsable(false)] statements, but no luck.
namespace MyCustomNamespace.Strokes
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public class LegendStroke : Stroke
{
public new Brush Brush { get { return base.Brush; } set { base.Brush = value; } }
[Browsable(false)]
public new DashStyleHelper DashStyleHelper { get { return base.DashStyleHelper; } set { base.DashStyleHelper = value; } }
public new int Opacity { get { return base.Opacity; } set { base.Opacity = value; } }
[Browsable(false)]
public new float Width { get { return base.Width; } set { base.Width = value; } }
}
}
Suspecting I'm missing something key to making derived expandable types work correctly in NinjaTrader, I also tried doing a similar derived expandable type test by implementing a user property based on a non-derived SimpleFont type (worked great) and derived SimpleFont property (LegendFont) and unfortunately received the same "Non-static method required a target" error message. The font-related code is below (uses newer style getter and setter syntax, but functionally equivalent to the older style getter and setter syntax above).
namespace MyCustomNamespace.Fonts
{
[TypeConverter(typeof(ExpandableObjectConverter))]
public class LegendFont : SimpleFont
{
public new bool Bold { get => base.Bold; set => base.Bold = value; }
public new bool Italic { get => base.Italic; set => base.Italic = value; }
public new FontFamily Family { get => base.Family; set => base.Family = value; }
public new double Size { get => base.Size; set => base.Size = value; }
}
}
Does anyone know how to correctly implement derived Stroke (or SimpleFont) user properties within NinjaScript?
Thanks!
-Cary
Comment