Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Add-on Serialization
Collapse
X
-
Add-on Serialization
I'm having a bit of trouble getting my add-on to serialize as expected. I have attached a sample to show the issue. The serialization seems to work if I simply close and reopen a workspace with the window, but if I restart NT the default settings are restored. Any ideas how to maintain the settings through a restart?
Tags: None
-
Hello,
To save specific values you would need to use the IWorkspacePersistance Save and Restore methods. There is a sample that demonstrates adding custom values to the workspace here: https://ninjatrader.com/support/foru...588#post822588
The take away is that you need to explicitly save anything which is not part of the base class being saved.
The values inside your Addon derived class won't be saved but you can save anything within your TabPage or NTWindow class which is where the persistence is used.
In the sample that you provided the base addon class should really only be used for adding a menu item and opening the window based on the menu click. The public properties you made could be removed and your initialize method in the view model you made can be removed. Any properties/logic your addon uses should go directly in the NTWindow derived class or if you use tabs then TabPage derived class. To set the values in the view model class you would need to do that from the Restore method that the NTWindow uses to load from the workspace data.
JesseNinjaTrader Customer Service
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Nickgiaco, 02-26-2024, 10:23 AM
|
2 responses
71 views
0 likes
|
Last Post Today, 05:12 AM | ||
Started by Johndc, Today, 04:39 AM
|
0 responses
4 views
0 likes
|
Last Post
by Johndc
Today, 04:39 AM
|
||
Started by johntraderuser2, Today, 02:34 AM
|
0 responses
9 views
0 likes
|
Last Post Today, 02:34 AM | ||
Started by IanS00, 03-27-2024, 11:24 AM
|
2 responses
13 views
0 likes
|
Last Post Today, 02:00 AM | ||
Started by Mariawilcoxi, Today, 01:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by Mariawilcoxi
Today, 01:32 AM
|
Comment