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 charlesugo_1, 05-26-2026, 05:03 PM
            0 responses
            60 views
            0 likes
            Last Post charlesugo_1  
            Started by DannyP96, 05-18-2026, 02:38 PM
            1 response
            145 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 05-11-2026, 05:56 AM
            0 responses
            161 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 05-10-2026, 08:12 PM
            0 responses
            97 views
            0 likes
            Last Post CarlTrading  
            Started by Hwop38, 05-04-2026, 07:02 PM
            0 responses
            283 views
            0 likes
            Last Post Hwop38
            by Hwop38
             
            Working...
            X