Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting - Limit Vs. Market

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

    Backtesting - Limit Vs. Market

    My strategy allows the user to select the type of target orders to use - Limit or Market orders. I find that when backtesting with Limit Orders, I get much more realistic results data than I so with Market orders. I understand the Strategy Analyzer has only 4 points of data to work with (OHLC), but the help document does not say anything (that I could find) about the type of order during the backtest.

    It appears that when I backtest my strategy using market orders it uses the bar close as the fill price. When I use Limit orders, it uses the limit price as the fill price.

    Is this correct?

    Thanks,

    -Scott

    p.s. I'm using CalculateOnBarClose = false.

    #2
    Market Orders will be filled at the next possible price which would be the Open of the next bar.

    CalculateOnBarClose has no bearing during backtesting because it is always true. You have OHLC at the end of a bar so since you have C you are at bar close.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Josh,

      That's what I figured, but wanted to be sure.

      Thanks,

      -Scott

      Comment


        #4
        On this topic, the backtesting with a limit order seems not to work as I expect.
        What I expect is
        "Fill at the limit price or better"
        but what I see happening on a backtest is
        "Filled exactly at the limit price even if a better price was available" (e.g. the opening price of the new bar)

        Take a look at the image example, which is a Short entry being filled with a limit order equal to the previous bar close and two ticks worse. This is the exact price that I get filled at, EVEN THOUGH the open of my fill bar is a better price. I entered this with a EnterShortLimit() order.

        This is not realistic for real life. A broker would not bypass a better price in order to get the limit price. Is there a workaround, or am I missing something?
        Cheers,
        saltminer
        Attached Files

        Comment


          #5
          saltminer,

          This is the case because NinjaTrader takes a conservative approach to fill logic to prevent any potential overstating of profitability. You can try switching your Fill Type to Liberal and see if it helps.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by wzgy0920, 04-20-2024, 06:09 PM
          2 responses
          27 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 02-22-2024, 01:11 AM
          5 responses
          32 views
          0 likes
          Last Post wzgy0920  
          Started by wzgy0920, 04-23-2024, 09:53 PM
          2 responses
          49 views
          0 likes
          Last Post wzgy0920  
          Started by Kensonprib, 04-28-2021, 10:11 AM
          5 responses
          193 views
          0 likes
          Last Post Hasadafa  
          Started by GussJ, 03-04-2020, 03:11 PM
          11 responses
          3,235 views
          0 likes
          Last Post xiinteractive  
          Working...
          X