Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtesting with market orders

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

    Backtesting with market orders

    Hello Ninjas,

    i have a system that sends market orders. I have read about backtesting in Ninja for limit and stop orders, but not for market order. So, i would like to know how backtest acts for market orders. Is the order filled when price is taken, when price is crossed or backtest realizes the amounts in bid and ask in every moment?

    Regards and thanks so much,

    Nachig.

    #2
    Based on my experience, market orders do not have the "same bar profit target" problem that limit orders do in backtests. This is a good thing, and means you don't have to code a fix.

    But, based on my experience, market orders go off at the close of the bar, not at the ask (long) or bid (short), which would be much more likely of a true market order.

    You can do a pseudo-market order by doing GetCurrentAsk() or GetCurrentBid() and place a limit order on that. However, if you do, you'll have to code a fix for the "same bar profit target" issue. You'll also run into this issue using Buy Stop or Sell Stop orders.

    I've backtested a lot. A *whole* lot. And I have come to the conclusion that it is best to use market orders in backtests. Also make sure your Fill Policy is set to Default, not Liberal, for most accurate results.

    Mike

    Comment


      #3
      Hello ctrlbrk,

      thanks for your quick reply. One cuestion more, please. When i use a system whit simulated account in a market, are the orders sent and filled the same than real market?

      Thank you very much,

      Nachig.

      Comment


        #4
        Hello ctrlbrk,

        thanks for your quick reply. One cuestion more, please. When i use a system whit simulated account in a market, are the orders sent and filled the same than real market?

        Thank you very much,

        Nachig.

        Comment


          #5
          nachig, with Mar****rders you just enter on the next possible price as your order hits the market, so the orders are the if you trade on the Sim101 account, but the fills can of course be different in real team live trading. For this you can add 'Slippage' to your backtest results to make sure it does not 'break' your system's edge going live.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          72 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          43 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          25 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          28 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          59 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X