Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

problems getting account info

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

    problems getting account info

    Hello- I'm having an issue with the GetAccountValue(AccountItem.CashValue) statement.

    I keep getting zero. This is with a live strategy. I am connected to IB with the strategy enabled with the account selected. I'm putting this statement in the OnStartUp() method because I only need this info on start up of the strategy.

    any ideas?

    #2
    Hello ciro1963,

    Thanks for your inquiry.

    GetAccountValue() will return 0 for historical bars and only will return an actual value for realtime bar iterations. This also means that calling from OnStartUp() would return 0.

    Reference on GetAccountValue() can be found here - https://ninjatrader.com/support/help...countvalue.htm

    Please let us know if you have any additional questions.

    Comment


      #3
      Yes I tried putting the statement in the onbarupdate but still comes out as zero. Could it be getting confused with the sim account? Also Does the statement return a string or do I need to convert it to a string in order to print it to the output window?

      Comment


        #4
        Hello ciro1963,

        Are you making sure that the value is getting printed for realtime bars and not historical bars?

        This can be tested with if(Historical) return;

        I've attached a demonstration showing the print for the Sim101 account and a paper trading account. You can set up a similar test on your end as well.

        Demo: https://www.screencast.com/t/H7Ys7M0w4W

        Please let me know if there is anything else I can do to assist.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        115 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        161 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        83 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        127 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        87 views
        0 likes
        Last Post PaulMohn  
        Working...
        X