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

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 aussugardefender, Today, 01:07 AM
      0 responses
      3 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      4 views
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Working...
      X