Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Distract margin from order

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

    Distract margin from order

    Hi guys, I'm wondering if it is possible to obtain the margin of an order after it is created. For example in the 'OnOrderUpdate' or 'OnExecutionUpdate' methods the order is passed as a parameter. I looked at the values inside these properties but couldn't find the margin at first sight. I did find a GetConversionRate inside the Order.Instrument property so I'm guessing this one could be used to calculate the margin? A predifined value would be better of course.

    Is it also possible to add the margin to the Trades overview in the Strategy Analyzer?

    Kind regards
    David

    #2
    Hello Vanderbeke,

    Thank you for your note.

    I have attached a sample which will check the initial margin of the instrument before entering long.

    Please let us know if you have any questions or need further assistance.
    Attached Files
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      Hi Alan

      Thanks for your answer!

      When I use the following "Risk.Get("NinjaTrader Brokerage Default").ByMasterInstrument[Instrument.MasterInstrument].InitialMargin;" will I then get the margin required for 1 standard contract?

      I've also came accros the following in another forum post. "GetAccountValue(AccountItem.InitialMargin") Is this also useful?

      Kind regards
      David

      Comment


        #4
        Hello Vanderbeke,

        GetAccountValue is a NT7 method and will not work in NT8.

        Regarding your first question, I would suggest applying the attached indicator to a 10 second chart, then opening an output window via Control Center>New>Output Window. The script will print the Initial Margin of that instrument. Next go to Control Center>Tools>Risk and find the instrument you applied the script to, and look at initial margin.

        Then go to CME.com and click the Trading tab at the top of the page, and find the instrument of interest. On that instrument page, go to Margins.

        With the three pieces of data you should be able to answer your first question.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by gravdigaz6, Yesterday, 11:40 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by MarianApalaghiei, Yesterday, 10:49 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by XXtrader, Yesterday, 11:30 PM
        0 responses
        4 views
        0 likes
        Last Post XXtrader  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        28 views
        0 likes
        Last Post love2code2trade  
        Started by funk10101, Yesterday, 09:43 PM
        0 responses
        9 views
        0 likes
        Last Post funk10101  
        Working...
        X