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...
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
Saving user choices through restarts?
Collapse
X
-
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...
Tags: None
-
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
-
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.
Comment
-
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 Gibranes, Today, 10:05 AM
|
5 responses
21 views
0 likes
|
Last Post Today, 01:55 PM | ||
Started by love2code2trade, Today, 01:45 PM
|
0 responses
3 views
0 likes
|
Last Post Today, 01:45 PM | ||
Started by 09try, 03-29-2024, 01:27 PM
|
9 responses
81 views
0 likes
|
Last Post
by ntcat
Today, 01:16 PM
|
||
Started by ninza33, Today, 06:28 AM
|
4 responses
17 views
0 likes
|
Last Post
by ninza33
Today, 12:38 PM
|
||
Started by ScottWalsh, Yesterday, 04:29 PM
|
4 responses
18 views
0 likes
|
Last Post Today, 12:00 PM |
Comment