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

Account.AccountItemUpdate event not firing (Continuum)

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

    Account.AccountItemUpdate event not firing (Continuum)

    Hello Support Team,

    In my Addon, I am performing some calculations using the updated PnL value of the open position using the AccountItemUpdate event.

    I am using two different Continuum connections 1) Phillip Capital futures account, 2) OANDA forex account.

    On the forex account, Account.AccountItemUpdate event fires as expected each time the open equity of the position changes. On the futures account, the only event firing is PositionUpdate when a position is opened or closed.

    Logically, this behavior doesn't make any sense. I am using multi-threading practices where needed. I don't understand how the PnL would be getting calculated in the Control Center but yet events aren't firing in my Addon (for the futures account). Am I missing something here? Is this a bug?

    Thank you in advance for your help.

    #2
    Hello CDXTrader,

    Thanks for your post.

    I have attached an indicator that adds account level AccountItemUpdate events.

    I wanted to test this on a paper account before markets closed but I was not able to. I'll provide a demonstration testing this script as soon as I am able tomorrow. In the meantime, if you would like to test this on your end ensuring you have enabled the indicator against the account in question, please do.

    EDIT: I am seeing similar behavior with CQG/Continuum based connections and I am investigating further. I will be following up after that investigation has concluded.

    I will be replying back tomorrow after I have been able to test and prepare demonstration.
    Attached Files
    Last edited by NinjaTrader_Jim; 12-22-2020, 04:21 PM.
    JimNinjaTrader Customer Service

    Comment


      #3
      Jim, thank you for the response.

      I was able to test your script on the sim accounts and it appeared to work as expected (as does my addon script). I have not yet tested it on the live account in question. I will post again once I have had a chance to perform that test. Cheers

      Comment


        #4
        Jim,
        I have tested the script with the indicator enabled for the account in question (Continuum / Phillip Capital). It appears the AccountItemUpdate event only fires on the closing of a position. This is the same behavior as in my Addon test. Here is the resulting output of your test script:

        Code:
        Position Open:
        orderId='eb875077cd5b4cd4a08c9c479c5ebc1d' account='#######' name='Entry Short' orderState=Initialized instrument='MES 03-21' orderAction=Sell orderType='Market' limitPrice=3697.75 stopPrice=0 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1300 time='2020-12-23 12:41:42' gtd='2099-12-01' statementDate='2020-12-23'
        orderId='eb875077cd5b4cd4a08c9c479c5ebc1d' account='#######' name='Entry Short' orderState=Submitted instrument='MES 03-21' orderAction=Sell orderType='Market' limitPrice=3697.75 stopPrice=0 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1300 time='2020-12-23 12:41:42' gtd='2099-12-01' statementDate='2020-12-23'
        orderId='1890166686' account='#######' name='Entry Short' orderState=Accepted instrument='MES 03-21' orderAction=Sell orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1300 time='2020-12-23 12:41:42' gtd='2099-12-01' statementDate='2020-12-23'
        orderId='1890166686' account='#######' name='Entry Short' orderState=Working instrument='MES 03-21' orderAction=Sell orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Day oco='' filled=0 averageFillPrice=0 onBehalfOf='' id=1300 time='2020-12-23 12:41:42' gtd='2099-12-01' statementDate='2020-12-23'
        orderId='1890166686' account='#######' name='Entry Short' orderState=Filled instrument='MES 03-21' orderAction=Sell orderType='Market' limitPrice=0 stopPrice=0 quantity=1 tif=Day oco='' filled=1 averageFillPrice=3697.5 onBehalfOf='' id=1300 time='2020-12-23 12:41:42' gtd='2099-12-01' statementDate='2020-12-23'
        Instrument: MES 03-21 Quantity: 1 Price: 3697.5
        
        
        Position Close:
        Account: ####### AccountItem: CashValue Value: #####
        Account: ####### AccountItem: GrossRealizedProfitLoss Value: 0
        Account: ####### AccountItem: RealizedProfitLoss Value: 0
        orderId='1890175677' account='#######' name='Entry Short' orderState=Filled instrument='MES 03-21' orderAction=Sell orderType='Limit' limitPrice=3698 stopPrice=0 quantity=1 tif=Day oco='' filled=1 averageFillPrice=3698 onBehalfOf='' id=1299 time='2020-12-23 12:38:34' gtd='2099-12-01' statementDate='2020-12-23'
        Instrument: MES 03-21 Quantity: 1 Price: 3698
        Is this the expected behavior? I would hope that it's not. Given that Phillip is one of NinjaTrader's primary FCM partners (and has been for years), I would certainly expect to receive full API functionality from that connection. I look forward to understanding more.

        12-28-2020
        Thanks, Jim. I look forward to hearing more about your investigation.
        Last edited by CDXTrader; 12-28-2020, 01:09 PM.

        Comment


          #5
          Hello CDXTrader,

          I have been able to see the same behavior and I have reported it. I am awaiting review from our Quality Assurance and Development teams.

          My expectation for AccountItems would reflect what is checked in the Accounts Tab documentation. Please scroll to the bottom to see which AccountItems are supported with each broker.

          Accounts tab - https://ninjatrader.com/support/help...TheAccountsTab

          I'll reply back once this matter gets reviewed internally.
          JimNinjaTrader Customer Service

          Comment


            #6
            Hello CDXTrader,

            We have made suggested edits to the help guide to note that CQG connections do not update Unrealized PnL.

            I gave another test confirming CQG connections versus NinjaTrader Continuum connections, and I do get updates for Unrealized PnL on NinjaTrader 8 Release 23.2 with a NinjaTrader Continuum demo account. My screenshot shows my results.

            Could you test the script again and also monitor the Accounts tab of the Control Center? (Please ensure you are updated to Release 23.2.) You should be seeing Unrealized PnL update in the Control Center and the prints will be seen in the output window as long as the NinjaTrader Continuum account is selected when the indicator is applied.

            Update platform - https://ninjatrader.com/PlatformDirect

            I look forward to hearing from you.

            Attached Files
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by EdwardFainau, Today, 10:21 PM
            0 responses
            1 view
            0 likes
            Last Post EdwardFainau  
            Started by PaulMohn, 09-15-2021, 05:25 AM
            21 responses
            106 views
            0 likes
            Last Post omololu
            by omololu
             
            Started by mcosta72, Today, 04:09 PM
            0 responses
            15 views
            1 like
            Last Post mcosta72  
            Started by Quanto, Today, 02:50 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_ChrisL  
            Started by Trader108, Today, 01:45 PM
            2 responses
            15 views
            0 likes
            Last Post Trader108  
            Working...
            X