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 kinfxhk, 07-13-2026, 10:18 AM
        0 responses
        58 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 09:50 AM
        0 responses
        41 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-13-2026, 07:21 AM
        0 responses
        46 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by kinfxhk, 07-11-2026, 02:11 AM
        0 responses
        37 views
        0 likes
        Last Post kinfxhk
        by kinfxhk
         
        Started by SalmaTrader, 07-07-2026, 10:26 PM
        0 responses
        156 views
        0 likes
        Last Post SalmaTrader  
        Working...
        X