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

Forex Margin / Risk

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

    Forex Margin / Risk

    Hey there

    I've entered FXCM's margin requirements for my account into the Risk window.

    How can I access this info from Ninjascript? I would like to know how much margin a position will take up before it gets submitted and also keep track of available account margin.

    Thanks

    Kevin.

    #2
    Hello Reach4thelasers,

    Thank you for writing in.

    You could use the following which will give you the initial margin of the instrument the strategy is applied to,

    Code:
    Risk.Get("NinjaTrader Brokerage Default").ByMasterInstrument[Instrument.MasterInstrument].InitialMargin;

    I have attached a sample strategy which will check that your account value is greater than initial margin and if so, will submit a buy order.

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

    Comment


      #3
      Hello,
      I have a similar issue. I am trying to get the initial margin for a strategy I am trading on a given instrument. After the last Update my FOREX.com account lost the ability to set a Risk Template. So, I can not use “NinjaTrader Brokerage Default” as the input Risk Template.

      Can I accomplish this task by stating

      double GTBinitialMargin = ByMasterInstrument [Instrument.MasterInstrument ].InitialMargin;

      ?

      Comment


        #4
        Hello GTBrooks,

        Risk templates cannot be applied to live accounts.

        Account values for funded brokerage accounts are received directly from the connected broker if that account value item is provided by that brokerage connection type.

        Below is a link to a forum post that lists the account values provided for each brokerage type.
        https://ninjatrader.com/support/foru...ances#post5625

        Forex.com does not provide a AccountItem.InitialMargin value.

        https://ninjatrader.com/support/help...ccountitem.htm
        https://ninjatrader.com/support/help.../en-us/get.htm


        This means you would need to contact your broker to obtain this information and then manually code this into your script or create an input.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by sidlercom80, Today, 11:26 AM
        0 responses
        7 views
        0 likes
        Last Post sidlercom80  
        Started by connorgrant5, Today, 10:29 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by frslvr, Today, 09:38 AM
        4 responses
        11 views
        0 likes
        Last Post frslvr
        by frslvr
         
        Started by guitarcombs, Today, 09:21 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_PatrickG  
        Started by Kawasaki, 03-18-2021, 08:48 PM
        6 responses
        2,209 views
        0 likes
        Last Post aytacasan  
        Working...
        X