• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 Boonfly8, Today, 02:04 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by Branpo, Today, 01:25 PM
          4 responses
          9 views
          0 likes
          Last Post Branpo
          by Branpo
           
          Started by aslane, Today, 12:47 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by HavasuTrader, Today, 12:30 PM
          1 response
          10 views
          0 likes
          Last Post NinjaTrader_PatrickG  
          Started by Boonfly8, Today, 12:20 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Working...
          X