Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Backtest vs real-time Chart orders placed at Open of next bar vs Close of curr bar?

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

    Backtest vs real-time Chart orders placed at Open of next bar vs Close of curr bar?

    Hi,

    I'm a little confused as to where the orders are placed after a trade. If using CalculateonBarClose=true, the orders SHOULD be placed at the open price of the next bar since the close price has passed when the bar is evaulated. Is there a difference between backtesting and intra-day charting. I just want to make sure of the following example.

    For example:

    When backtesting a strategy, does the EnterLong() function print the trade price at the Open of the next bar and draw the arrow on the next bar or the Current bar?

    Then, when running that same strategy on real-time data intraday, will the order be drawn/printed at the same Open price on the next bar after receiving the signal?

    I have noticed an instance where my backtest chart and real-time chart print different trade prices for the same bar, same signal, same strategy.

    I can clarify if needed, but thanks in advance for your help!
    Rick

    #2
    tomace,

    Your assumption is correct. The trade will show up on the open of the next bar. As far as trying to print it out. Traces of the order will likely occur on the next bar in backtesting, but in real-time you may get the order placement at the current bar depending on how illiquid the market is. Trying to print fill prices is a different story. Fill prices are very dynamic and will of course differ. In real-time you have a lot of market dynamics taken into consideration. This is not done in backtesting.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Josh,

      Okay, my question is strictly with the simulated trades. Let me give you specific examples to help me understand. When running a strategy on SPY(very liquid), a buy order is printed on the 12:06 bar at $77.01. However, when backtesting the same stategy (same everything), I get a buy order printed on the chart on the 12:07 bar @ $77.00. Visually I can see that the 12:06 bar was the one that received the buy signal.

      I guess I was just wondering if this was always the case, that the backtest placed the order on the next bar OPEN, but the real-time places it at the current bar CLOSE? Is that what is programmatically supposed to happen?

      Comment


        #4
        tomace,

        For sure that is suppose to happen. In backtesting when you have the close price of the bar you no longer can trade on that bar. In real-time it is completely different due to market conditions.

        Please review this article about the differences between backtesting and real-time: http://www.ninjatrader-support.com/H...TimeVsBacktest
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RubenCazorla, Today, 09:07 AM
        1 response
        5 views
        0 likes
        Last Post RubenCazorla  
        Started by Irukandji, Today, 09:34 AM
        0 responses
        3 views
        0 likes
        Last Post Irukandji  
        Started by TraderBCL, Today, 04:38 AM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        11 responses
        1,423 views
        0 likes
        Last Post jculp
        by jculp
         
        Started by BarzTrading, Today, 07:25 AM
        2 responses
        29 views
        1 like
        Last Post BarzTrading  
        Working...
        X