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 bmartz, 03-12-2024, 06:12 AM
          5 responses
          32 views
          0 likes
          Last Post NinjaTrader_Zachary  
          Started by Aviram Y, Today, 05:29 AM
          4 responses
          13 views
          0 likes
          Last Post Aviram Y  
          Started by algospoke, 04-17-2024, 06:40 PM
          3 responses
          28 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gentlebenthebear, Today, 01:30 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by cls71, Today, 04:45 AM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Working...
          X