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

different instrument actions?

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

    different instrument actions?

    Hi,

    Is it possible to modify a strategy code based upon which instrument the strategy is applied to? For example:

    if(USD/JPY){variable = 1;}
    if(EUR/USD){variable = 54;}
    if(EUR/JPY){variable = 12;}

    I'm NOT attempting to do anything other than have the strategy determine what instument it is applied to...I want to be able to change certain variables within the strategy (as above) based upon this information. Is this possible?

    #2
    Sure. Please see either of these properties: http://www.ninjatrader-support.com/H...umentName.html
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      Thanks for that info, this seems useful. In usage, would I have to do something like this? (online help is non-specific):

      if(Instrument.MasterInstrument.Name == "USDJPY"){do something;}

      Is that correct syntax? Thanks again.

      Comment


        #4
        Correct. Just match the string with the instrument name. I suggest you use a Print on Instrument.MasterInstrument.Name to see what it returns so you can match the formatting and such.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Thank you. What about chart time periods? Is it possible to determine if a strategy is being applied to charts with, for example, 5 and/or 30 minute time intervals?

          Comment


            #6
            BarsPeriod.Id
            BarsPeriod.Value
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thank you for the useful information...

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by geotrades1, Today, 10:02 AM
              1 response
              4 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by ender_wiggum, Today, 09:50 AM
              1 response
              5 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by rajendrasubedi2023, Today, 09:50 AM
              1 response
              12 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by bmartz, Today, 09:30 AM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_Erick  
              Started by geddyisodin, Today, 05:20 AM
              3 responses
              26 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X