Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Adjusting trade size based on funds availability

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

    Adjusting trade size based on funds availability

    Hello,

    How do I obtain available funds/margin for entering a trade? I would like to the trade quantity based on available, usable funds.

    In looking at the Help documentation, is this correct?

    double buyingPower = Account.GetAccountItem(AccountItem.BuyingPower, Currency.UsDollar).Value;

    ​That seems like a lot of "extra" code to access an attribute on an account. Why doesn't the Account object have straightforward properties?

    Thanks,
    Matt

    #2
    Hello, thanks for writing in. Using the Account object is the correct way to access account values in the strategy. The method to access any account item is Account.Get()


    Comment


      #3
      Hello Support / Chris,

      When I using this code to obtain the buying power in Playback, I'm getting 0.0. ​In the Control Panel, it clearly shows $100,000 for the Playback account.

      double buyingPower = Account.Get(AccountItem.BuyingPower, Currency.UsDollar);

      Is this the correct code to get the buying power for a given trade? That is, with this buyingPower variable, I want to determine the number of contracts I should trade (code not shown).
      If it is the correct code for live trading (I've not tested/confirmed yet), what the correct code for playback?

      Thanks,
      Matt

      Comment


        #4
        Hello Matt,

        Neither the Sim101 nor the Playback accounts provide a Buying power account item.

        Check the Accounts tab of the Control Center and you see the Buying power is 0 for the Playback account.

        However, the CashValue is available, and you can use this.
        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by CarlTrading, 03-31-2026, 09:41 PM
        1 response
        43 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        20 views
        0 likes
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        30 views
        1 like
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        48 views
        0 likes
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        38 views
        0 likes
        Last Post CarlTrading  
        Working...
        X