Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Refresh Strategy Analyzer property values after State.SetDefaults

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

    Refresh Strategy Analyzer property values after State.SetDefaults

    Hi there,

    I was wondering whether is there any way to access and refresh the [NinjaScriptProperty] values exposed to the Strategy Analyzer UI after the State left SetDefaults? I am trying to achieve the next: I created a txt file containing the results of a previous optimization and at State.Configure I read this file and set the values of the exposed properties to values found in the file. This way i dont have to spend a lot of time setting up the Strat Analyzer UI. And this part works just fine. My only problem is that the UI remains setted to the default values even if the values changed during State.Configure.

    Is there any way to solve this and refresh the values printed to the UI? Just like when we select a template.
    Or if the template like approach does not work, would it be possible to use a type converter to refresh the values?
    Also, would you be able to help when and how a type converter is called? Can I trigger it or is it integrated into the system?

    The best would be if it could take place in the Configure state (just before the actual run).

    Thanks a lot, Adam

    #2
    Hello Altemor,

    Welcome to the NinjaTrader forums!

    I understand your meaning and changing parameters from State.Configure in the Strategy Analyzer doesn't reflect in the UI because that is not the actual instance populating the UI the way that the instance on a chart is the instance populating the UI.
    This is because for every backtest and optimization iteration a new cloned instance of the strategy is created.

    Unfortunately, custom typeconverters do not function in the strategy analyzer when optimizing.
    I am aware of the type converter sample, and have used portions of it to hide/show properties. My question is how can this be applied when in the optimizer? For example, if I have a bool property, I want to show other properties if it is set to True or Optimize.



    If you just need to know what the values are, you can print (or write to file) the variable in State.DataLoaded.

    else if (State == State.DataLoaded)
    {
    Print(MyVariableName); // you could also choose to write the values to a text file with a StreamWriter here
    }

    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    94 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    140 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    125 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    74 views
    0 likes
    Last Post PaulMohn  
    Working...
    X