Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Analyzer Backtest Void last trade due to "Exit on Close" Trade in

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

    Strategy Analyzer Backtest Void last trade due to "Exit on Close" Trade in

    Still new to utilizing NinjaTrader 7's Strategy Analyzer but enjoying the learning process. Coming across a problem that can provide incorrect results and wanted to reach out to see if this can be mitigated through programming.

    In a backtest, is it possible to drop an individual trade from the output because of a certain exit has been hit? To clarify, if there is a specific condition/action set up to exit a long position, but since the long entry is carried through to the end of the testing period, it is automatically closed on the testing period end date and corresponding price. Can it be coded that the trade is never entered because it does not naturally get closed out based on the condition/action?

    Hypothetical Example: Buy when 5 day ma crosses above 20 day. Sell position when 5 day ma crosses below 20 day. Attached is a snap shot on a single stock that shows multiple Exit's based on the sell set up in the conditions/actions, but the last trade is exited because it bumps into the end date of the testing period. Can this trade not be included in the summary statistics as it will skew results? Just trying to get "pure" results from conditions/actions to validate strategies worthiness (and no the 5/20 cross is not the real strategy I am working on).

    Appreciate the help and guidance.
    Attached Files

    #2
    Hello Bahrmarket,

    Thank you for writing in and welcome to the NinjaTrader Support Forum!

    You can disable the "Exit on close" handling.

    Within the Strategy Analyzer's backtest parameters, there will be an "Exit on close" parameter within the "Order Handling" category. Set this to false. Your strategy will no longer exit at the close of a session.

    If you would like to code this directly into your strategy script, you'll want to add this within the Initialize() method:
    Code:
    ExitOnClose = false;
    More information about the ExitOnClose property can be found here: https://ninjatrader.com/support/help...xitonclose.htm

    Please, let us know if we may be of further assistance.
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      Zachary - Thanks for the quick reply. I get the concept of "Exit on Close" True/False (which I already have set up to false). The answer I am really trying to get a handle on is the ability to not include a simulated trade because it basically ran out of bars to execute the sell condition and is simply exited on that last bar of the testing period. I view that exit as artificial and not part of a strategy, but it is included in the strategy results which makes the test invalid. - Thanks.
      Last edited by Bahrmarket; 03-04-2016, 02:56 PM.

      Comment


        #4
        Hello Bahrmarket,

        You would be unable to remove the "exit on close" exit execution at the end of the backtesting period.

        Please, let us know if we may be of further assistance.
        Zachary G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by frankthearm, Yesterday, 09:08 AM
        12 responses
        43 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by junkone, Today, 11:37 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by quantismo, 04-17-2024, 05:13 PM
        5 responses
        35 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by proptrade13, Today, 11:06 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by love2code2trade, 04-17-2024, 01:45 PM
        4 responses
        35 views
        0 likes
        Last Post love2code2trade  
        Working...
        X