Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Programmatic access to Parameters list

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

    Programmatic access to Parameters list

    Hi Folks, I've been trying to figure this out for several days and haven't had any luck.

    I'm trying to get a list of my Parameters at run time (use on first bar routine in OnBarUpdate) so I can store the values in a data base. I want to do this so I can reuse the same technique with multiple strategies and keep a generic database of the parameters and let NT generate the appropriate SQL on the fly instead of having to rewrite it myself every time a change a parameter.

    Clearly NT does this since we can give the Parameters values in Backtest, Optimize and Walkforward.

    I've tried various things around the Category attribute. Any ideas?

    Thanks!
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    You could try something like this.

    Code:
     
    IndicatorBase[] ib = ChartControl.Indicators;
    foreach (var item in ib)
    {
        Print(item.ToString());
    }
    That will print each indicator on the chart to the output screen in this form:
    EMA(Typical of TF 06-11 (4 Range),34)
    MACD(TF 06-11 (4 Range),12,26,9)

    You would have to add the code you need in the foreach loop to store item.ToString() where you want it.

    BTW, putting it in OnStartUp() would be a better place than a routine in OnBarUpdate().

    Hope this helps.

    VT

    Comment


      #3
      Thanks VT,

      This got me on the right track.

      What I needed was:

      foreach(Parameter p in Parameters)
      {
      Print(p.Name);
      }

      Seems I got sidetracked by Attributes.

      Thanks also for the OnStartUp() tip. Turns out this is the event I really needed.
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Hwop38, 05-04-2026, 07:02 PM
      0 responses
      176 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      331 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      253 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      356 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      183 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X