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!
See more
See less

Partner 728x90

Collapse

Add-on Serialization

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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?

    Attached Files

    #2
    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

    Comment


      #3
      Awesome. Thank you!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by PhillT, Today, 02:16 PM
      2 responses
      6 views
      0 likes
      Last Post PhillT
      by PhillT
       
      Started by Kaledus, Today, 01:29 PM
      3 responses
      10 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by frankthearm, Yesterday, 09:08 AM
      14 responses
      47 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by gentlebenthebear, Today, 01:30 AM
      2 responses
      14 views
      0 likes
      Last Post gentlebenthebear  
      Started by PaulMohn, Today, 12:36 PM
      2 responses
      17 views
      0 likes
      Last Post PaulMohn  
      Working...
      X