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 spottysallrite, Today, 11:31 AM
|
1 response
2 views
0 likes
|
Last Post Today, 11:43 AM | ||
Started by johnMoss, 03-04-2024, 01:53 PM
|
2 responses
31 views
0 likes
|
Last Post
by Overnhou
Today, 11:21 AM
|
||
Started by Padan, Today, 02:02 AM
|
5 responses
17 views
0 likes
|
Last Post Today, 11:14 AM | ||
Started by Lele2k24, Yesterday, 11:24 AM
|
8 responses
28 views
0 likes
|
Last Post
by Lele2k24
Today, 11:00 AM
|
||
Started by kramnor2001, Yesterday, 02:30 PM
|
4 responses
24 views
0 likes
|
Last Post
by bltdavid
Today, 10:44 AM
|
Comment