Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Does OnPositionUpdate or OnExecutionUpdate Get Called During Manual Exit?

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

    Does OnPositionUpdate or OnExecutionUpdate Get Called During Manual Exit?

    Hi all,

    I'm working on a custom base Strategy class that will log the PnL of each trade once the trade exits. This seems to be working fine now, and I'm handling this logging logic (writing to a CSV file) in OnPositionUpdate once each trade exits.

    However, when I manually exit a trade using chart trader's "Close" button or from the accounts control panel right clicking the account and selecting "Close all selected account positions", nothing gets logged and it seems like OnPositionUpdate doesn't fire in those cases.

    Is this by design? How would I get the latest position update, and subsequent PnL of a closed trade, regardless of it the exit was manual or automated?

    Thanks as always,

    - Jay
    jaybedreamin
    NinjaTrader Ecosystem Vendor - Zion Trading Algos

    #2
    Hello jaybedreamin,

    Thank you for your post.

    OnPositionUpdate and OnExecutionUpdate will only be called for orders managed by your strategy. Manual orders are not managed by your strategy, which is why you are not seeing updates for these orders.

    From the Help Guide:

    "You will NOT receive position updates for manually placed orders, or orders managed by other strategies (including any ATM strategies) in OnPositionUpdate(). The Account class contains a pre-built event handler (PositionUpdate) which can be used to filter position updates on a specified account.​"



    As mentioned in the HG, you can instead use the AddOn approach and use PositionUpdate as well as ExecutionUpdate to track orders on a specified account, as opposed to only orders managed by the strategy.





    Please let us know if you have any further questions.

    Comment


      #3
      Thanks for the reply NinjaTrader_Gaby, interesting to know that neither fires in the event of a manual exit order. Can you suggest another way that I might accomplish my goal?

      I want to log the strategy name and the resulting PnL of each strategy, regardless if the strategy exited the trade or if the user manually exited.
      jaybedreamin
      NinjaTrader Ecosystem Vendor - Zion Trading Algos

      Comment


        #4
        Hello jaybedreaming,

        You can trade manual or automated exits using the AddOn approach with PositionUpdate or ExecutionUpdate as per my previous reply. These will track orders placed to the account rather than orders placed by a specific strategy. Strategies cannot "see" other strategies - meaning that the strategy can't track trades placed by another strategy. The only alternative would be to track trades via the account.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        54 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        130 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        72 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        44 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X