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

Trade details on order closed

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

    Trade details on order closed

    Hi

    I am trying to write some code that will get called when an open order is closed (in other words when an existing open position is closed, resulting in a profit or loss).

    I am planning to use the OnOrderUpdate event for this purpose, is this correct? What states of the IOrder object do I need to check so that my code only responds when an order is closed?

    Also, I don't see any properties on the IOrder or IExecution interfaces that would tell me what the closed trade's profit/loss and maximum drawdown was?

    Many thanks

    #2
    Hi Ravish, if you're interested in the position update event, then OnPositionUpdate() would be ideal - http://www.ninjatrader.com/support/h...tionupdate.htm

    Another option is checking directly for the execution event of your positon exit order, for example the stoploss or the target, that would be done via the IOrder objects in OnExecution() -



    A full working reference sample for this advanced management technique for your orders and positions would be offered here - http://www.ninjatrader.com/support/f...ead.php?t=7499

    Accessing performance info / stats would be possible via the Trade collections and Performance classes - http://www.ninjatrader.com/support/h...collection.htm
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thanks Bertrand, I'll look at these recommendations.

      I don't see anything in the Trade collections and Performance classes about drawdown, only PnL. When you backtest a strategy, the resulting report contains information about the strategy's maximum drawdown, so I'm assuming it must be calculated somewhere...?

      Comment


        #4
        Correct, the drawdown for the historical and / or realtime collections of trades would be available, too - http://www.ninjatrader.com/support/h...7/drawdown.htm
        BertrandNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bc24fl, 08-30-2019, 01:58 PM
        4 responses
        259 views
        0 likes
        Last Post PaulMohn  
        Started by sugalt, Today, 04:02 AM
        0 responses
        6 views
        0 likes
        Last Post sugalt
        by sugalt
         
        Started by tradingnasdaqprueba, 04-09-2024, 09:52 AM
        6 responses
        30 views
        0 likes
        Last Post tradingnasdaqprueba  
        Started by PaulMohn, Today, 02:06 AM
        1 response
        9 views
        0 likes
        Last Post PaulMohn  
        Started by Mindset, Today, 01:27 AM
        0 responses
        6 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Working...
        X