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 SalmaTrader, 07-07-2026, 10:26 PM
            0 responses
            47 views
            0 likes
            Last Post SalmaTrader  
            Started by CarlTrading, 07-05-2026, 01:16 PM
            0 responses
            22 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 06-17-2026, 10:32 AM
            0 responses
            15 views
            0 likes
            Last Post CaptainJack  
            Started by kinfxhk, 06-17-2026, 04:15 AM
            0 responses
            21 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Started by kinfxhk, 06-17-2026, 04:06 AM
            0 responses
            23 views
            0 likes
            Last Post kinfxhk
            by kinfxhk
             
            Working...
            X