Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get BuyingPower

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

    Get BuyingPower

    Hello,

    is it possible to get the BuyingPower and CashValue from the current account? Following code does not work:

    Print("BuyingPower: " + GetAccountValue(AccountItem.BuyingPower) + " CashValue: " + GetAccountValue(AccountItem.CashValue);

    Kind regards
    Gerik

    #2
    Hello Gerik,

    Thank you for your post.

    To clarify, is this for NinjaTrader 7 or NinjaTrader 8? You've posted in the NinjaTrader 8 forum, but that code would only be valid for NinjaTrader 7. In NinjaTrader 8 you'd need to use Account.Get():



    For example:

    Print(Account.Get(AccountItem.CashValue, Currency.UsDollar));
    Print(Account.Get(AccountItem.BuyingPower, Currency.UsDollar));

    Please let us know if we may be of further assistance to you.
    Kate W.NinjaTrader Customer Service

    Comment


      #3
      Hello Kate,

      using your example, I receive an error message that there is an object reference required for NinjaTrader.Cbi.Account.Get(NinjaTrader.Cbi.Accoun tItem, NinjaTrader.Cbi.Currency.

      What did I made wrong?

      Kind regards
      Gerik

      Comment


        #4
        Hello Gerik,

        Thank you for your reply.

        Are you using this in a strategy, or another type of script, like an Add-on or an indicator? Add-ons and indicators don't have an assigned account by default so you'd need to use the Add-on Account class to access an account and use Account.Get():



        Attached is a simple example strategy that just prints the account information for the account the strategy is running on to the lower right of the chart when applied.

        Please let us know if we may be of further assistance to you.
        Attached Files
        Kate W.NinjaTrader Customer Service

        Comment


          #5
          Hello Kate,

          I get a Buying Power of 0.00 although I have a Cash Value of > 0.

          Why is it like this?

          Kind regards
          Gerik

          Comment


            #6
            Hello Gerik,

            Thank you for your reply.

            What is the Buying Power listed in the accounts tab for the account you're running the test strategy on? If it's a sim account, the value for Buying Power will always be zero. For a live account, it would depend on whether your broker provides that statistic for the account - some brokers provide this value and some do not.

            Please let us know if we may be of further assistance to you.
            Kate W.NinjaTrader Customer Service

            Comment


              #7
              Hello Kate,

              in the accounts tab for the account it is showing a BuyingPower of 0,00 $.

              Why brokers provide that statistics?

              Kind regards
              Gerik

              Comment


                #8
                Hello Gerik,

                Thank you for your reply.

                Those values come from the broker when available - since there's no broker for the Sim account there would be nothing that would come through for that account if that's the account you're looking at.

                Please let us know if we may be of further assistance to you.
                Kate W.NinjaTrader Customer Service

                Comment


                  #9
                  Hello Kate,

                  is there a broker for the Live account then?

                  Kind regards
                  Gerik

                  Comment


                    #10
                    Hello Gerik,

                    Thank you for your reply.

                    To have a live trading account you would need to open one with a supported brokerage. If the broker you choose provides data for the Buying Power you would see it listed in the Accounts tab. If they do not, Account.Get(AccountItem.BuyingPower, Currency.UsDollar) would return 0.00.

                    Please let us know if we may be of further assistance to you.
                    Kate W.NinjaTrader Customer Service

                    Comment


                      #11
                      Hello Kate,

                      is there a list of brokers available that provide data for the Buying Power with Account.Get(AccountItem.BuyingPower, Currency.UsDollar) > 0.00 ?

                      Kind regards
                      Gerik

                      Comment


                        #12
                        Hello Gerik,

                        Thank you for your reply.

                        You can find a list of which brokerage connection technologies support which account values in our help guide here:



                        Please let us know if we may be of further assistance to you.
                        Kate W.NinjaTrader Customer Service

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by usazencort, Today, 01:16 AM
                        0 responses
                        1 view
                        0 likes
                        Last Post usazencort  
                        Started by kaywai, 09-01-2023, 08:44 PM
                        5 responses
                        603 views
                        0 likes
                        Last Post NinjaTrader_Jason  
                        Started by xiinteractive, 04-09-2024, 08:08 AM
                        6 responses
                        23 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Pattontje, Yesterday, 02:10 PM
                        2 responses
                        22 views
                        0 likes
                        Last Post Pattontje  
                        Started by flybuzz, 04-21-2024, 04:07 PM
                        17 responses
                        230 views
                        0 likes
                        Last Post TradingLoss  
                        Working...
                        X