Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Can I have different parameter for different instruments?

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

    Can I have different parameter for different instruments?

    Is there a way to set up a strategy so that the user parameters would be different depending on which instrument the strategy was trading? Let's say I want the YM to trade 5 contracts, but the ER2 to trade only 4. If I have a "Contracts" parameter for the strategy, how do I get it to change based on the instrument.

    And I already tried setting up some logic in the Initialization tag to check the instrument name and change the "Contracts" variable in the code to what I want. But that didn't seem to work -- it used the default value of the parameter anyway. Maybe the Properties are set after Initialization is called?? In that case, could I set the value there instead?

    Thanks!
    Bryan

    #2
    You would need to internally code it by checking the instrument and then setting some internal variable that represents the trade size. Then pass this variable into any order method.
    RayNinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Ray View Post
      You would need to internally code it by checking the instrument and then setting some internal variable that represents the trade size. Then pass this variable into any order method.
      I did that, but it didn't work. I guess then I coded it wrong. I'll try again, thanks Ray!

      Comment


        #4
        I mean internal in that you do not expose this as a parameter in a dialog window. Its likely that the parameter values are displayed before Initialize() is called etc...
        RayNinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Ray View Post
          I mean internal in that you do not expose this as a parameter in a dialog window. Its likely that the parameter values are displayed before Initialize() is called etc...
          Oh, I see what you mean. Yeah, OK... I can do that. I wanted to be able to change the value easily as a parameter, but maybe that's not the best method for something like this. I guess parameters override internal values even in the Init tag.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          602 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          347 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          103 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          559 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          558 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X