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 Mindset, 04-21-2026, 06:46 AM
        0 responses
        88 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        135 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        68 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        119 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        69 views
        0 likes
        Last Post PaulMohn  
        Working...
        X