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 Geovanny Suaza, 02-11-2026, 06:32 PM
            0 responses
            649 views
            0 likes
            Last Post Geovanny Suaza  
            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
            0 responses
            370 views
            1 like
            Last Post Geovanny Suaza  
            Started by Mindset, 02-09-2026, 11:44 AM
            0 responses
            109 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
            0 responses
            573 views
            1 like
            Last Post Geovanny Suaza  
            Started by RFrosty, 01-28-2026, 06:49 PM
            0 responses
            576 views
            1 like
            Last Post RFrosty
            by RFrosty
             
            Working...
            X