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

Simple backtest question: When calling EnterLong, what is the fill price?

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

    Simple backtest question: When calling EnterLong, what is the fill price?

    Greetings.

    I have spent a ridiculous amount of time searching for an answer to this simple question.

    I am backtesting my strategy code. I am using the basic entry command to enter a position at market prices.

    Code:
    EnterLong(quantity, LONG_SIGNAL_NAME);
    I have further logic that depends on the fill price. I understand that backtesting cannot provide intra-bar prices. Still, the backtest simulation is using some price during its operations. How may I obtain the fill price of an EnterLong market order call during backtesting?

    If this documented somewhere in the online help, then I would appreciate a link. I certainly could not find one in my search.

    Thanks.

    #2
    Hello rgoudie,

    Strategies can fill at intra-bar prices if a 1 tick series has been added to the script.


    Without the 1 tick series, market orders that are submitted after a bar closes, fills at the open of the new bar.
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      I am not sure whether this answers my question. Are you trying to say that the following code would be correct?


      Code:
      EnterLong(quantity, LONG_SIGNAL_NAME);
      double fillPrice = Close[0];

      Comment


        #4
        Hello rgoudie,

        The EnterLong() call you have suggested does not use the BarsInProgressIndex of 1 (or which ever series is the added one tick series).

        EnterLong(int barsInProgressIndex, int quantity, string signalName)
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I don't even understand how barsInProgressIndex is relevant to my question. Just assume that I am using one series.
          My question is simply this:

          When I am testing a strategy using a backtest, when EnterLong executes, what fill price will it use?
          The command creates and order and enters a position, correct?
          What price does it use to fulfill the order during a backtest?
          Thanks.


          Originally posted by NinjaTrader_ChelseaB View Post
          Hello rgoudie,
          The EnterLong() call you have suggested does not use the BarsInProgressIndex of 1 (or which ever series is the added one tick series).
          EnterLong(int barsInProgressIndex, int quantity, string signalName)
          https://ninjatrader.com/support/help.../enterlong.htm

          Comment


            #6
            Hello rgoudie,

            You stated:
            "I understand that backtesting cannot provide intra-bar prices."

            This is incorrect. Adding a 1 tick series provides intra-bar prices.
            Each series has a bars in progress.
            To place orders and have intra-bar prices, you would need to submit the order to the bars in progress of the 1 tick series.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              No offense, Chelsea. Is there anybody else from NinjaTrader that understands my simple question and can answer it?

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by kaywai, Today, 06:26 AM
              1 response
              6 views
              0 likes
              Last Post kaywai
              by kaywai
               
              Started by ct, 05-07-2023, 12:31 PM
              6 responses
              204 views
              0 likes
              Last Post wisconsinpat  
              Started by kevinenergy, 02-17-2023, 12:42 PM
              118 responses
              2,780 views
              1 like
              Last Post kevinenergy  
              Started by briansaul, Today, 05:31 AM
              0 responses
              10 views
              0 likes
              Last Post briansaul  
              Started by traderqz, Yesterday, 12:06 AM
              11 responses
              28 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Working...
              X