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 geddyisodin, Yesterday, 05:20 AM
      7 responses
      45 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by gbourque, Today, 06:39 AM
      2 responses
      5 views
      0 likes
      Last Post gbourque  
      Started by cre8able, Yesterday, 07:24 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by cocoescala, 10-12-2018, 11:02 PM
      6 responses
      939 views
      0 likes
      Last Post Jquiroz1975  
      Started by cmtjoancolmenero, Yesterday, 03:58 PM
      1 response
      17 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Working...
      X