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

Which order type is most realistic?

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

    Which order type is most realistic?

    Hey guys I was just curious to know which order setup I should use to be most realistic in backtesting.

    I have a strategy that is written so that the orders are submitted on the first tick of a minute bar the entries are actually submitted using a stop entry market order, like this:

    CalculateOnBarClose = false;
    Unmanaged = true;
    PlaceMMExitOnEntry = true;

    EnterLongStop(1, EntryTarget); - This is submitted on first tick of minute bar

    I have the same strategy where CalculateOnBarsClose=true so im assuming it submits orders on the bar close, with for example exitShortSignal = ExitShort(1, "exitShortSignal", "enterShort") This strategy takes a signal from the same minute series as above and submits a market order for ES once the signal price is reached.

    What I have noticed is that the second strategy setup shows backtest as being 1 tick behind the other strategy setup above it.

    I would like to know, which one is the most realistic in backtesting? Which one would be better to use in real-time trading?

    Thanks,
    EliteTraderNYC

    #2
    If you'd like, you can always review the Fill() logic for any order types by going to Documents\NinjaTrader 7\bin\Custom\Type\ and the fill logic is in the @DefaultFillType.cs

    In there you will find the exact logic used when you use the default fills and there are some comments that help explain how each order will behave.

    As far as what is more realistic is a matter of opinion, and we will keep this thread open for other users to share their opinions and experience, but as a reminder you may feel free to modify and develop your own fill type with your own logic.

    MatthewNinjaTrader Product Management

    Comment


      #3
      As a follow up, lets say you just have minute bars in a strategy, would the actual fill price in a backtest be just an approximation of the possible exit/entry price? given that there is no realtime price info other than the minute data? Assuming calculateonbarclose=False?

      Comment


        #4
        Assuming you're using the default fill type, It would depend on the order type that is used in the strategy.

        A Market Order would be the Next high / low / next open (depending on buy vs sell) +/- any slippage points you configured.

        A limit order fills at the limit price once price has traded through it.

        Stop markets/Stop Limits fill using similar logic but will wait until price has traded at the stop price.

        This is evaluated at the end of each bar as there is no real-time data, however keep in mind that backtesting is always done COBC = True.

        If you need more granularity in your backtests, you can always program in a higher resolution such as a 1 second or 1 tick data following our reference sample:

        You can submit orders to different Bars objects. This allows you the flexibility of submitting orders to different timeframes. Like in live trading, taking entry conditions from a 5min chart means executing your order as soon as possible instead of waiting until the next 5min bar starts building. You can achieve this by
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mmckinnm, Today, 01:34 PM
        3 responses
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by f.saeidi, Today, 01:32 PM
        2 responses
        4 views
        0 likes
        Last Post f.saeidi  
        Started by alifarahani, 04-19-2024, 09:40 AM
        9 responses
        55 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by Conceptzx, 10-11-2022, 06:38 AM
        3 responses
        60 views
        0 likes
        Last Post NinjaTrader_SeanH  
        Started by traderqz, Today, 12:06 AM
        9 responses
        16 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X