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 Perr0Grande, Today, 08:16 PM
          0 responses
          2 views
          0 likes
          Last Post Perr0Grande  
          Started by elderan, Today, 08:03 PM
          0 responses
          3 views
          0 likes
          Last Post elderan
          by elderan
           
          Started by algospoke, Today, 06:40 PM
          0 responses
          10 views
          0 likes
          Last Post algospoke  
          Started by maybeimnotrader, Today, 05:46 PM
          0 responses
          9 views
          0 likes
          Last Post maybeimnotrader  
          Started by quantismo, Today, 05:13 PM
          0 responses
          7 views
          0 likes
          Last Post quantismo  
          Working...
          X