Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Entry Price does not match Entry Time in Strategy Analyzer

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

    Entry Price does not match Entry Time in Strategy Analyzer

    For simplicity, the strategy is a very simple EMA crossover. When 10 EMA crosses over 20 EMA, go long … and when the reverse happens, exit long … that’s it. It is on the ^SP500 DAILY CHART.

    Within the Strategy Analyzer, the “Entry price” column does not correspond to the “Entry time” column (when looking and comparing on the actual chart). This is under Display > Trades ($). This is of course while backtesting a strategy.

    For example, in the Strategy Analyzer window … Trade #1 says Entry Price of 3344.92 with an Entry time of 2/6/2020 4:00:00PM. When I look at the chart of the ^SP500, and go to the 2/6/2020 candlestick bar, the price of 3344.92 actually corresponds to 2/6/2020 9:30:00AM open price (not 4:00:00PM). The same issue is there for the Exit price and Exit time, they don’t match.

    This creates confusion when studying the strategy. Is there a way to resolve this?

    Thanks for any help!
    Last edited by dax3kk; 12-06-2020, 01:01 PM.

    #2
    Hello dax3kk,

    Welcome to the NinjaTrader forums!

    I am not able to reproduce. If the orders are market orders and are being submitted after the bar closes with Calculate as OnBarClose I would expect the orders to fill at the open of the next bar.

    Below is a link to a video that demonstrates testing the Sample MA Crossover included with NinjaTrader, opening the Strategy Performance window, and comparing the fill price of the order to the open of the bar with that time, on a daily chart.


    Please let me know if you follow the exact steps shown in the video but experience different behavior.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for the personalized video.

      Yes I do expect the order to fill at the open of the next bar. It is the TIME which seems to be incorrect. I can see the same thing in your video, the TIME shows 3:00:00 PM but the order fills at the open which is 9:30:00 AM.

      On my side, the time column is showing 4:00:00 PM whereas I would expect it to show 9:30:00 AM (the open).

      Do you know how to resolve this discrepancy?

      Thank you

      Comment


        #4
        Hello dax3kk,

        With the historical data, all we know is the close time of the bar unless intra-bar granularity is introduced.

        The historical executions are provided the close time of the bar the filled on. The fill could have been any time while that bar was open.

        With 1 tick granularity, and the orders placed to that 1 tick series, the executions would show the exact time and price of the order fill accurate to within 1 tick.

        Below is a link to a forum post in intra-bar granularity.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Hi Chelsea,

          That makes sense, thanks for clarifying. The link you provided is great! I have a followup question please that is very much related. Again this is for historical back-testing and assume we are not using intra-bar granularity for the sake of simplicity.

          Assume there are 3 daily bars on the ^SP500 one after the other, as follows:
          2/5/2020 (Bar 1)
          2/6/2020 (Bar 2)
          2/7/2020 (Bar 3)

          Assume the strategy I'm testing "triggers" a SELL market order on Bar 1 (with Calculate as OnBarClose). Based on our previous discussion, the SELL order will execute on the open of the next bar, which is Bar 2. Assume the strategy would also like to use the realized gains (if positive of course) from this SELL order in order to send a new BUY order to another instrument, say AAPL. When will this new BUY order execute? Will it execute on the open of Bar 3?

          Thank you so much.

          Comment


            #6
            Hello dax3kk,

            Keep in mind that indexes like the ^SP500 cannot be traded.

            If the Strategy is running with Calculate OnBarClose on a daily chart and an order is submitted after a bar closes, this would would be submitted at the open of the next bar. A market order will fill at the open. Other order types would fill if the submission bar has a valid fill price.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by geddyisodin, Yesterday, 05:20 AM
            8 responses
            51 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            10 responses
            36 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by DayTradingDEMON, Today, 09:28 AM
            4 responses
            24 views
            0 likes
            Last Post DayTradingDEMON  
            Started by George21, Today, 10:07 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by Stanfillirenfro, Today, 07:23 AM
            9 responses
            25 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X