Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 ZenCortexCLICK, Today, 04:58 AM
          0 responses
          5 views
          0 likes
          Last Post ZenCortexCLICK  
          Started by sidlercom80, 10-28-2023, 08:49 AM
          172 responses
          2,281 views
          0 likes
          Last Post sidlercom80  
          Started by Irukandji, Yesterday, 02:53 AM
          2 responses
          18 views
          0 likes
          Last Post Irukandji  
          Started by adeelshahzad, Today, 03:54 AM
          0 responses
          8 views
          0 likes
          Last Post adeelshahzad  
          Started by Barry Milan, Yesterday, 10:35 PM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X