• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Error in reading cash balance from IB

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

    Error in reading cash balance from IB

    Dear ninjatraders,

    I am a program newbie and am currently developing a test code for the automated trading using NT7 and IB TWS. But when I tested it with my active account in IB, it does not read my account info (cash balance). More details are following.


    The Problem

    1. When I run the code (the whole code below) in backtesting, it works well with the "DefaultAccountSize".
    2. However, in the live trading with IB TWS, the code does not read my account balance and the strategy still works with the DefaultAccountSize.


    I appreciate any comments for this problem.

    Thank you very much.

    Best regards,
    CUK.

    --------------------------------------------------
    Last edited by hhyang95; 03-11-2016, 02:52 PM.

    #2
    Hello,

    Thank you for the question.

    This would be directly associated with the way that GetAccountValue() works. If we look in the help guide in its description it shows this method returns either the account value or during historical bars the value of 0.

    In backtests this would be the same, a 0 value would be reported.

    The expected result when running live would be to show the account balance. I did try your code and placed a Print() statement in your TradeSize int like the following:

    Code:
    private int TradeSize
    {
         get
         {
               double gav = GetAccountValue(AccountItem.CashValue);
    	   Print(gav);
    I was using the Sim101 account on Live data and I did see 0 values as the script ran through historical which is expected, upon the condition becoming true I did see my account balance printed to the Tools -> Output Window.

    I wanted to double check that you are seeing the balance from IB reported in the Accounts tab in NinjaTrader correct?

    Also what version of TWS are you using? this can be found when you start IB on the splash screen. The supported version is 944.3, if you are using a different version this could be the cause.

    I look forward to being of further assistance. .
    JesseNinjaTrader Customer Service

    Comment


      #3
      Dear Jesse,

      I do see my IB account info in the Account tab in NT7 (latest version), and I checked that my TWS version is 944.3.

      I still don't understand how my strategy fails in reading the IB cash value during live trading.

      I can send you my strategy script via email if you are willing to test it in your sim account.

      Thank you so much for your help.

      Best regards,
      cuk

      Comment


        #4
        Hello,

        Thank you for the offer.

        If you could send that to me to platformsupport @ ninjatrader.com and reference ticket 1231807 I would appreciate that.

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Dear Jesse,

          I sent my code to you.

          Thanks for your help.

          Best regards,
          cuk

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Steve L, Today, 05:01 PM
          0 responses
          5 views
          0 likes
          Last Post Steve L
          by Steve L
           
          Started by Trader-Joe, Today, 04:06 PM
          1 response
          13 views
          0 likes
          Last Post NinjaTrader_ShawnB  
          Started by vantojo, Today, 04:06 PM
          0 responses
          5 views
          0 likes
          Last Post vantojo
          by vantojo
           
          Started by tonynt, Today, 02:39 PM
          2 responses
          13 views
          0 likes
          Last Post tonynt
          by tonynt
           
          Started by StevenNelson, Today, 12:23 PM
          1 response
          12 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Working...
          X