• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by YevhenShynkarenko, Today, 08:14 AM
      0 responses
      1 view
      0 likes
      Last Post YevhenShynkarenko  
      Started by YevhenShynkarenko, Today, 07:14 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Jim  
      Started by ttodua, Today, 06:47 AM
      0 responses
      2 views
      0 likes
      Last Post ttodua
      by ttodua
       
      Started by Derjan, Today, 03:09 AM
      1 response
      9 views
      0 likes
      Last Post NinjaTrader_PaulH  
      Started by usero86, Today, 04:28 AM
      5 responses
      25 views
      0 likes
      Last Post NinjaTrader_PatrickG  
      Working...
      X