My indicator adds a menu to the chart toolbar. The menu entries are used to toggle various things on and off. I use IsChecked so that the menu entries show whether that item is enabled.
NinjaTrader freely creates new objects, such as when connecting to a data source. That is fine, but I need the state of the menu entries to persist so that things do not change underneath the user when any of several things occur that cause a new instance to be created.
I have read that the way to persist data is to use public properties. As I understand it, there are two independent relevant attributes:
[Browsable(false)] -- true/false controls whether or not the property is shown in the configuration dialog.
[XmlIgnore] -- controls whether or not the property gets serialized (i.e. is persistent).
There must be something wrong with my understanding. The properties I want to persist are type bool so there should be no problem serializing them. I do not set [XmlIgnore] so I expect the property to be persisted. Unfortunately, if I set [Browsable(false)], to keep the property out of the configuration dialog, the property is not persisted. The property is persisted if I set no attributes, but then it also appears in the configuration dialog -- which I do not want.
So, the obvious question is: how can my indicator have persistent state variables without them showing in the configuration dialog?
Comment