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

How to get tradable amount from online broker with margin?

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

    How to get tradable amount from online broker with margin?

    Hello,

    My question is regarding risk-management, and I need to know which amount I should read from my online broker when calculating my trade position for each particular trade.
    In most cases, the available trade amount is calculated like this: Equity (Cash + papers) - (Margin requirement) = Current Available Funds.

    As I will use FXCM and Ninjatrader Continuum, I need to know how to fetch this amount from my online broker in order to calculate the correct tradable amount using a Ninjatrader strategy for a particular currency pair or stock instrument.

    Any advice or information is appreciated!

    Thanks!
    Warcious

    #2
    Hello warcious,

    Thanks for your post.

    You can use GetAccountValue() for each account: http://ninjatrader.com/support/helpG...countvalue.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thank you for your answer Paul. But which of these three items corresponds to my formula:
      Equity (Cash + papers) - (Margin requirement) = Current Available Funds.
      ----
      Ninjascript:
      GetAccountValue()
      Possible values:
      AccountItem.BuyingPower
      AccountItem.CashValue
      AccountItem.RealizedProfitLoss

      Comment


        #4
        Hello warcious,

        Thanks for your reply.

        Regrettably not all items are available to fulfill your formula, please see: http://ninjatrader.com/support/forum...ead.php?t=5474 for what is available by broker/connection.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          So what you are saying that for:
          1)
          FXCM I can only fetch the
          Cash Value

          and for
          2) Ninjatrader Continuum I can only fetch
          Cash Value
          Realized PnL

          Then how could I fetch my available trading amount including my margin?
          Maybe I can manually enter the margin requirement somehow?

          Comment


            #6
            Hello warcious,

            Thanks for your reply.

            Yes, you could create input variables to hold the manually entered information.

            In terms of margin, you can edit the instruments (va the instrument manager) and add that value (as there is a field for it) and then retrieve in Ninjascript through the undocumented code of Instrument.MasterInstrument.Margin.

            http://ninjatrader.com/support/helpG...nstruments.htm
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kujista, Today, 06:23 AM
            4 responses
            14 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by traderqz, Yesterday, 09:06 AM
            2 responses
            15 views
            0 likes
            Last Post traderqz  
            Started by traderqz, Today, 12:06 AM
            3 responses
            6 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by RideMe, 04-07-2024, 04:54 PM
            5 responses
            28 views
            0 likes
            Last Post NinjaTrader_BrandonH  
            Started by f.saeidi, Today, 08:13 AM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X