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.
    JimNinjaTrader Customer Service

    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.
        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by AaronKoRn, Today, 09:49 PM
        0 responses
        10 views
        0 likes
        Last Post AaronKoRn  
        Started by carnitron, Today, 08:42 PM
        0 responses
        9 views
        0 likes
        Last Post carnitron  
        Started by strategist007, Today, 07:51 PM
        0 responses
        10 views
        0 likes
        Last Post strategist007  
        Started by StockTrader88, 03-06-2021, 08:58 AM
        44 responses
        3,980 views
        3 likes
        Last Post jhudas88  
        Started by rbeckmann05, Today, 06:48 PM
        0 responses
        9 views
        0 likes
        Last Post rbeckmann05  
        Working...
        X