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 junkone, Today, 11:37 AM
          0 responses
          6 views
          0 likes
          Last Post junkone
          by junkone
           
          Started by quantismo, 04-17-2024, 05:13 PM
          5 responses
          35 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by proptrade13, Today, 11:06 AM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_Clayton  
          Started by love2code2trade, 04-17-2024, 01:45 PM
          4 responses
          34 views
          0 likes
          Last Post love2code2trade  
          Started by cls71, Today, 04:45 AM
          2 responses
          10 views
          0 likes
          Last Post eDanny
          by eDanny
           
          Working...
          X