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

Saving user choices through restarts?

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

    Saving user choices through restarts?

    What is the preferred way to save user inputs in an AddOn through restarts of NT? Specifically, I have a custom Checkbox control on chart trader in my AddOn. I'd like to be able to persist the state of the checkbox through a restart of the platform. I've seen some examples of writing data files to disk, but I don't know if that is the best approach.

    For further clarity - I'm reasonably sure I'm not talking about IWorkspace Persistence here as I am not creating my own NTWindow, but idk...



    #2
    Hello NickyD,

    For what you described that depends on how you implemented the addon. If that is from an indicator you could use a public property and that would allow saving the users initial choice with the template/workspace. After the script is applied changing the user inputs would be bad practice to save something because that requires the user knows the value was changed so they can go save the workspace. Writing a file is likely the best option here to make a constant state, the value would just be written to file after being toggled. You could then reload the value in State.Configure. You could use any properties from the chart/indicator to make a filename unique to that script.

    You are also correct, the IWorkspace Persistence is only for addons that implement the NTWindow/TabPage classes.

    JesseNinjaTrader Customer Service

    Comment


      #3
      hmm... at the moment, there is no indicator involved at all. I am simply using OnWindowCreated and some other custom methods in my AddOn code. So for this, I understand writing it to disk to be the best option.



      that depends on how you implemented the addon. If that is from an indicator you could use a public property and that would allow saving the users initial choice with the template/workspace.
      Are you saying that I could create public properties on my AddOn that would save with the template/workspace? Or are you talking about public properties for an indicator that I could then pass back/invoke the addon with? Or none of the above?

      Comment


        #4
        Hello NickyD,

        The same process would apply with OnWindowCreated, you would have to collect some relevant info from the window you have and then for the toggle of the checkbox use that infor to write the file.

        The comment for the indicator properties is specific to indicators, as you are not using an indicator the only option would be to save the data yourself.

        JesseNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by junkone, Today, 11:37 AM
        0 responses
        5 views
        0 likes
        Last Post junkone
        by junkone
         
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        34 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        34 views
        0 likes
        Last Post love2code2trade  
        Started by cls71, Today, 04:45 AM
        2 responses
        10 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Working...
        X