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 Taddypole, 04-26-2024, 02:47 PM
        5 responses
        35 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Started by kujista, 04-23-2024, 06:23 AM
        6 responses
        47 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by giulyko00, 04-24-2024, 12:03 PM
        7 responses
        36 views
        0 likes
        Last Post eDanny
        by eDanny
         
        Started by NM_eFe, Today, 10:13 AM
        0 responses
        10 views
        0 likes
        Last Post NM_eFe
        by NM_eFe
         
        Started by hdge4u, Yesterday, 12:23 PM
        1 response
        10 views
        0 likes
        Last Post hdge4u
        by hdge4u
         
        Working...
        X