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 ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      44 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      20 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      180 views
      0 likes
      Last Post jeronymite  
      Started by DanielSanMartin, Yesterday, 02:37 PM
      2 responses
      13 views
      0 likes
      Last Post DanielSanMartin  
      Working...
      X