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 rtwave, Today, 01:49 PM
            0 responses
            8 views
            0 likes
            Last Post rtwave
            by rtwave
             
            Started by papaoutai, Today, 08:56 AM
            0 responses
            22 views
            0 likes
            Last Post papaoutai  
            Started by jdspwe, Today, 05:22 AM
            0 responses
            13 views
            0 likes
            Last Post jdspwe
            by jdspwe
             
            Started by JeremuFemstu, Today, 04:49 AM
            0 responses
            16 views
            0 likes
            Last Post JeremuFemstu  
            Started by pjsmith, Today, 04:11 AM
            1 response
            21 views
            0 likes
            Last Post Green Lobster CBD  
            Working...
            X