• 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 Vincere, Yesterday, 11:20 PM
      0 responses
      3 views
      0 likes
      Last Post Vincere
      by Vincere
       
      Started by lMagi, 05-18-2019, 09:34 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChrisSch  
      Started by uday12, Yesterday, 10:26 PM
      0 responses
      2 views
      0 likes
      Last Post uday12
      by uday12
       
      Started by uday12, Yesterday, 10:07 PM
      0 responses
      0 views
      0 likes
      Last Post uday12
      by uday12
       
      Started by Nabil, Yesterday, 07:46 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Working...
      X