Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing Instrument Margin in a Strategy

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

    Accessing Instrument Margin in a Strategy

    Hi,

    Is there a way to access the primary instrument's Margin value (from the Instrument Editor) in the code of a strategy? I have entered these values in manually already in the Instrument Editor.

    Thanks.

    #2
    Hello ShatteredX,

    Thank you for the post.

    Although undocumented you can access the "MasterInstrument" which essentially contains the definition of the instrument that you would see in the instrument manager.

    This would be the syntax:

    Code:
    protected override void OnBarUpdate()
    {
    	Print(Instrument.MasterInstrument.Margin);
    }

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      That works, thanks Jesse!

      Comment


        #4
        Originally posted by NinjaTrader_Jesse View Post
        Although undocumented you can access the "MasterInstrument" which essentially contains the definition of the instrument that you would see in the instrument manager.

        This would be the syntax:

        Code:
        protected override void OnBarUpdate()
        {
        Print(Instrument.MasterInstrument.Margin);
        }

        I look forward to being of further assistance.
        NinjaTrader_Jesse is there equivalent access somewhere else for the instrument margin (intraday as well) in NT8?

        Comment


          #5
          Hello b.j.d,

          In NT8 there is no longer a margin associated with the instrument directly. If you want to define risk you can use risk templates in NT8. There is currently no supported way to access those values but you can see the following post which shows an unsupported means to access risk templates and get data from them. Keep in mind risk templates are only used for Sim accounts, if you want to know the margin for your live account which you see in the account tab you need to use the addon framework with account.Get() method to get those values. If you need help on that topic please make a new thread under the NinjaTrader desktop -> indicator or strategy development sub forums.

          https://forum.ninjatrader.com/forum/...26#post1205026
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by ageeholdings, Today, 07:43 AM
          0 responses
          6 views
          0 likes
          Last Post ageeholdings  
          Started by pibrew, Today, 06:37 AM
          0 responses
          4 views
          0 likes
          Last Post pibrew
          by pibrew
           
          Started by rbeckmann05, Yesterday, 06:48 PM
          1 response
          14 views
          0 likes
          Last Post bltdavid  
          Started by llanqui, Today, 03:53 AM
          0 responses
          6 views
          0 likes
          Last Post llanqui
          by llanqui
           
          Started by burtoninlondon, Today, 12:38 AM
          0 responses
          12 views
          0 likes
          Last Post burtoninlondon  
          Working...
          X