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

GUI parameters

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

    GUI parameters

    I have a multi-instrument strategy with an array of Add() contracts. In the GUI I want to have a parameter that inputs the current expiry month (06-20) for each array member.

    [Description("ES Current Expiry Contract")]
    [Category("Parameters")]
    [Display(Name="ES Current Expiry Contract", Order=5, GroupName="My Parameters")]
    public double ESExpiryMonth
    {
    get { return eSExpiryMonth; }
    set { eSExpiryMonth = value; }
    }


    which would insert the value as so:


    AddDataSeries("ES &" "& eSExpiryMonth", new BarsPeriod { BarsPeriodType = BarsPeriodType.Minute, Value = 405 }, "CME US Index Futures RTH");


    Am I on the right track here?
    Regards

    #2
    Hello elliot5,

    As a heads up, using dynamic variables with AddDataSeries() is officially not supported by NinjaTrader to do.

    From the help guide:
    "Arguments supplied to AddDataSeries() should be hardcoded and NOT dependent on run-time variables which cannot be reliably obtained during State.Configure (e.g., Instrument, Bars, or user input). Attempting to add a data series dynamically is NOT guaranteed and therefore should be avoided. Trying to load bars dynamically may result in an error similar to: Unable to load bars series. Your NinjaScript may be trying to use an additional data series dynamically in an unsupported manner."


    I think you are wanting to concatenate a string as the instrument symbol, is this correct?
    Something like
    "ES " + ESExpiryMonth
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Yes that is correct.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by jxs_xrj, 01-12-2020, 09:49 AM
      6 responses
      3,290 views
      1 like
      Last Post jgualdronc  
      Started by Touch-Ups, Today, 10:36 AM
      0 responses
      7 views
      0 likes
      Last Post Touch-Ups  
      Started by geddyisodin, 04-25-2024, 05:20 AM
      8 responses
      61 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by Option Whisperer, Today, 09:55 AM
      0 responses
      8 views
      0 likes
      Last Post Option Whisperer  
      Started by halgo_boulder, 04-20-2024, 08:44 AM
      2 responses
      24 views
      0 likes
      Last Post halgo_boulder  
      Working...
      X