Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to make backtested orders fill at the next traded price on gaps?

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

    #16
    Close[0] is the last price of a building bar if the bar has not closed yet and CalculateOnBarClose = false. In backtesting, CalculateOnBarClose is always true. There is no intrabar information available.

    Input[0] is for when you have PriceTypeSupported = true. Then you can choose if you want Open, High, Low, Close, Typical, etc. and it will take on whichever series you chose.

    If you want to backtest with intrabar granularity please see this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=6652
    Josh P.NinjaTrader Customer Service

    Comment


      #17
      Hi Josh,

      I have looked at the SampleIntraBar and still this is not good enough.
      If your primary Bars 60 min and execution on 5 min(secondary) and entry condition is true on the open of trading(or shortly after) then you have to miss a big chunk of the move becouse you have to wait untill the end of the 60 min Bar. I don't understand why,if you backtest on the chunk of data that has all the timeframes , you can place intrabar order on the next bar, but not the current bar? And besides the Higher timeframe is only used to generate condition for the entry, why on earth it is impossible to register condition as soon as it happens? This limitation truly makes backteasting from higher timeframes impossible!
      What about real time simulation? Will I get intrabar on the current bar?

      Thank you for help.

      Comment


        #18
        xtrender,

        Unless you are using a 1tick time frame in backtesting you for sure do not have the intrabar information. You only have each bar's OHLC. Since you always have the close of the bar when you generate a signal you can only trade on the next tradeable time. This time is the open of the next bar.

        If you use real-time testing for sure you can get intrabar fills because you do have the intrabar information.
        Josh P.NinjaTrader Customer Service

        Comment


          #19
          Josh,

          Is it possible with real time datafeed to backtest intrabar conditions in simulated(paper) mode in Ninja and do I have to enable automated trading for this?

          Thank you.

          Comment


            #20
            xtrender,

            You can forward test on a real-time feed. Forward testing is different than backtesting. Backtesting only has OHLC information available to you. All you need to do to forward test is connect to your feed and throw the strategy onto a chart.
            Josh P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by cmoran13, Yesterday, 01:02 PM
            0 responses
            31 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            22 views
            0 likes
            Last Post PaulMohn  
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            160 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            95 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            148 views
            2 likes
            Last Post CaptainJack  
            Working...
            X