• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Multi-Instruments question...

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

    Multi-Instruments question...

    Hello,
    I am using this code to access a secondary instrument: AddDataSeries("MES 09-19", Data.BarsPeriodType.Minute, 1, Data.MarketDataType.Last);
    My strategy is running on primary instrument "ES" but my orders are being executed in "MES".

    Is there a way to replace "MES 09-19" for a variable?
    My idea is to have this as an input with a drop-down box where I can select the instrument I want.

    Usually we have this "field" for the inputs.
    [NinjaScriptProperty]
    [Range(1, int.MaxValue)]
    [Display(Name="Test", Order=1, GroupName="Parameters")]
    public int Test
    { get; set; }

    How to properly code for a instrument selection?

    Thanks in advance,
    Allan

    #2
    Hello Velhinho,

    Welcome to the NinjaTrader Forums!

    Unfortunately, it is not supported to use variables with AddDataSeries().

    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."
    https://ninjatrader.com/support/help...dataseries.htm
    Chelsea B.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Leeroy_Jenkins, Yesterday, 09:17 AM
    1 response
    48 views
    0 likes
    Last Post NinjaTrader_Melissa  
    Started by chaitunt, 03-29-2020, 08:26 PM
    1 response
    13 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by mbcmbc, Yesterday, 11:01 PM
    2 responses
    17 views
    0 likes
    Last Post mbcmbc
    by mbcmbc
     
    Started by Zuhier Dourgham, Yesterday, 03:55 AM
    1 response
    29 views
    0 likes
    Last Post NinjaTrader_Jim  
    Started by b16_aln, Today, 12:47 AM
    6 responses
    23 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Working...
    X