Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Syntax for variable instruments

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

    Syntax for variable instruments

    Hi guys.

    I have a strategy with multiple instruments.

    Currently the instruments are hard coded with:

    Add("ZN 12-08", PeriodType.Tick, 1);

    How can I code it so that the date "12-08" is replaced with a variable string that I can modify in the parameters. I know how to set up a user defined input. Just dont know how to code the Add() line.

    Cheers

    #2
    Unfortunately this is not supported.

    Comment


      #3
      Originally posted by raz0rback View Post
      Hi guys.

      I have a strategy with multiple instruments.

      Currently the instruments are hard coded with:

      Add("ZN 12-08", PeriodType.Tick, 1);

      How can I code it so that the date "12-08" is replaced with a variable string that I can modify in the parameters. I know how to set up a user defined input. Just dont know how to code the Add() line.

      Cheers
      Let's say your date is a string in the configuration parameters. The variable is expirationDate. Couldn't you just do:

      Add("ZN" + " " + expirationDate, PeriodType.Tick, 1);

      I'm working on the same problem, but I have indexes & commodities and they don't all have the same expiration dates so it's even more complicated.

      Comment


        #4
        Unfortunately this is not supported.

        Comment


          #5
          Originally posted by NinjaTrader_Dierk View Post
          Unfortunately this is not supported.
          Does "not supported" mean it has been tested and doesn't work, or you do not answer questions if we try it?

          I don't see any reason why it wouldn't work but I haven't tried it myself.

          Comment


            #6
            It likely won't work.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            633 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            364 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            567 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            568 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X