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 tsantospinto, 04-12-2024, 07:04 PM
            5 responses
            67 views
            0 likes
            Last Post tsantospinto  
            Started by cre8able, Today, 03:20 PM
            0 responses
            6 views
            0 likes
            Last Post cre8able  
            Started by Fran888, 02-16-2024, 10:48 AM
            3 responses
            47 views
            0 likes
            Last Post Sam2515
            by Sam2515
             
            Started by martin70, 03-24-2023, 04:58 AM
            15 responses
            114 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by The_Sec, Today, 02:29 PM
            1 response
            8 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X