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

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 flybuzz, Today, 10:33 AM
            0 responses
            1 view
            0 likes
            Last Post flybuzz
            by flybuzz
             
            Started by algospoke, 02-19-2024, 03:25 PM
            6 responses
            40 views
            0 likes
            Last Post Abiodun
            by Abiodun
             
            Started by LillyMarv, Today, 06:47 AM
            1 response
            11 views
            0 likes
            Last Post marcus2300  
            Started by michi08, Today, 08:51 AM
            1 response
            7 views
            0 likes
            Last Post bltdavid  
            Started by awwenzovs, Today, 08:03 AM
            1 response
            9 views
            0 likes
            Last Post bltdavid  
            Working...
            X