Test case:
Create a new indicator with the wizard, with no properties and no plots. Compile. Edit the code to match that below. Compile.
Create a new workspace. open a chart, and add the indicator. The output window will show that OnBarUpdate has seen the default value. Save and close the workspace.
You can confirm in the XML file that NT has serialized the new value (true).
Re-open the workspace. NT has invoked the property setter; yet OnBarUpdate is still seeing the default value! What is even going on here?
Any help?
namespace NinjaTrader.Indicator { [Description("Enter the description of your new custom indicator here")] public class TestIndicator : Indicator { private bool testProperty = false; private bool setOnce = false; private bool whatOnBarUpdateSees = false; private readonly Font font = new Font("Arial Unicode MS", 8F); private readonly SolidBrush brush = new SolidBrush(Color.White); protected override void Initialize() { } protected override void OnBarUpdate() { if (!setOnce) { whatOnBarUpdateSees = testProperty; setOnce = true; Print("whatOnBarUpdateSees=" + whatOnBarUpdateSees); } testProperty = true; } [Browsable(false)] public bool TestProperty { get { Print("TestProperty.get: testProperty=" + testProperty); return testProperty; } set { Print("TestProperty.set: old=" + testProperty + " new=" + value); testProperty = value; } } } }
Comment