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

AvgProfit == Average Net Profit?

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

    #16
    Excellent, this is proving to be super helpful.

    So on Slippage, is there any way to generate a backtest for 3 ticks of roundtrip Slippage? If my understanding of your Slippage explanation (below) is correct, one could only have 0, 2, 4, 6, etc roundtrip Slippage ticks because the Slippage value in the Strategy Analyzer dialog box is per side and needs to be an integer (i.e., 0, 1, 2, 3, etc)?

    Thanks, Aventeren

    Comment


      #17
      Hi aventeren,

      You could try using 1.5 but I'm not going to recommend it.

      If you enter with a limit and exit with a market or stop market then only the market will have the slippage and you could use 3.
      Chelsea B.NinjaTrader Customer Service

      Comment


        #18
        Originally posted by NinjaTrader_ChelseaB View Post
        Hi aventeren,

        You could try using 1.5 but I'm not going to recommend it.

        If you enter with a limit and exit with a market or stop market then only the market will have the slippage and you could use 3.
        From what I've read, I've been advised against using limit orders in backtesting because they generate unrealistic results. However, the following might produce reasonable back testing results:

        1. Modify the strategy for back testing purposes to enter with limit orders (i.e., EnterLongLimit() and EnterShortLimit()) and exit with market orders (i.e., ExitLong() and ExitShort()).

        2. Select "Default" in the "Fill type" parameter in the Strategy Analyzer dialog box, which amongst other things specifies that limit orders will only fill if penetrated. The documentation does not say anything about how the Default Historical Fill Processing in Operations > Strategy Analyzer > Understanding historical processing options > Historical Fill Processing handles market orders, but I'm assuming that market orders are considered executed if touched (can you please confirm this)?

        3. Enter 3 for the Slippage value in the Strategy Analyzer dialog box, such that the back test engine will then add 0 ticks Slippage to the limit order and 3 ticks Slippage to the market (stop) order.

        Does that seem likely to produce a back test with 3 ticks of roundtrip Slippage?

        Also, can you please confirm with the Default Fill Type in the Historical Fill Processing dialog box that although limit orders will only be filled if penetrated, that market orders will still be filled with the specified Slippage when touched?

        Thanks,

        Aventeren

        Comment


          #19
          Hi averteren,
          Originally posted by aventeren View Post
          From what I've read, I've been advised against using limit orders in backtesting because they generate unrealistic results. However, the following might produce reasonable back testing results:

          1. Modify the strategy for back testing purposes to enter with limit orders (i.e., EnterLongLimit() and EnterShortLimit()) and exit with market orders (i.e., ExitLong() and ExitShort()).

          2. Select "Default" in the "Fill type" parameter in the Strategy Analyzer dialog box, which amongst other things specifies that limit orders will only fill if penetrated. The documentation does not say anything about how the Default Historical Fill Processing in Operations > Strategy Analyzer > Understanding historical processing options > Historical Fill Processing handles market orders, but I'm assuming that market orders are considered executed if touched (can you please confirm this)?

          3. Enter 3 for the Slippage value in the Strategy Analyzer dialog box, such that the back test engine will then add 0 ticks Slippage to the limit order and 3 ticks Slippage to the market (stop) order.

          Does that seem likely to produce a back test with 3 ticks of roundtrip Slippage?

          Also, can you please confirm with the Default Fill Type in the Historical Fill Processing dialog box that although limit orders will only be filled if penetrated, that market orders will still be filled with the specified Slippage when touched?

          Thanks,

          Aventeren

          You are likely referring to how the Default fill type requires that the price passes through a limit for it to fill.
          Try using the Liberal fill type instead. This fills limits when they are touched and does not require a pass through. In a way that is more like the real market while the Default fill type is more like a worst case scenario.

          Market / Stop Market orders will be filled at the open price of the next bar every time.

          Yes, it does seem likely that a limit order entry and market order exit would result in 3 ticks of slippage. But I recommend that you test this and confirm.

          Yes, I can confirm (through testing) that the market order will have slippage applied (within the price range of the bar) using the Default or Liberal fill types and that limit orders will need to be passed through when using the Default fill type.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #20
            Originally posted by NinjaTrader_ChelseaB View Post
            Hi averteren,



            You are likely referring to how the Default fill type requires that the price passes through a limit for it to fill.
            Try using the Liberal fill type instead. This fills limits when they are touched and does not require a pass through. In a way that is more like the real market while the Default fill type is more like a worst case scenario.

            Market / Stop Market orders will be filled at the open price of the next bar every time.

            Yes, it does seem likely that a limit order entry and market order exit would result in 3 ticks of slippage. But I recommend that you test this and confirm.

            Yes, I can confirm (through testing) that the market order will have slippage applied (within the price range of the bar) using the Default or Liberal fill types and that limit orders will need to be passed through when using the Default fill type.
            Thanks, Chelsea.

            I understand where you are coming from on the Liberal vs Default fill type (as it relates to limits being executed when touched or when penetrated, respectively), but I think I'm going to stick with the Default fill type so that this portion of my back test will have the potential to under-promise and over-deliver (i.e., guaranteed that the entry price would have been achieved) rather than over-promise and under-deliver (i.e., live miss an entry b/c price moved away).

            I'll make sure to test the limit and stop = 3 ticks slippage. That might be a decent way to test to 3 ticks.

            On the entries, your answer sheds light on why others use a secondary data series (i.e., 1 range) for entries and exits. Clearly using the secondary series for exits makes intuitive sense for back testing, but until you pointed out that a market order is not assumed to be executed until the open of the next bar, I did not understand why others used a secondary series for order entries. Now (I think) I do. For example, if you were back testing a daily bar and market entry order, then you would have to assume that if the OHLC met your entry condition that the assumed entry price would not be until the open of the next bar. But instead, if you had a piece of logic that first identified if the OHLC of the bar triggered the entry, which then dropped you into a secondary series to simulate the entry price, a better simulation would occur if you were planning on using COBC = false for your actual live testing. If you were using only going to be using COBC = true, then it likely wouldn't matter, as a live order would not be triggered until the open of the next bar anyway. I'll have to think about this...

            Thanks for your help.

            All best,

            Aventeren

            Comment


              #21
              So I've been thinking about this commission and slippage issue, and another way to assume slippage for backtest purposes may be to just hardcode in the slippage and commission costs within the Tools > Options > Commissions > Futures - Simulator > Commission levels.

              For instance, let's say that you use a $2.50/side commission, and that you have plugged that number into the Futures - Simulator Commissions value. But, you also want to assume that on average you are also going to incur 3 ticks of roundtrip slippage. Therefore, what you may consider doing would be to calculate the instrument specific cost of 1.5 ticks, and then just add this to the $2.50 Futures - Simulator Commissions value.

              For example, let's say that you're backtesting the ES contract and that you are assuming $2.50/side in commission and 3 ticks roundtrip slippage. 3 ticks * $12.50/tick = $37.50 slippage. Therefore, you would divide $37.50 in half ($37.50 / 2 = $18.75) and add that number to $2.50 ($2.50 + $18.75 = $21.25) in the Commissions value, and you then have a net backtest result regardless of what order type you elect to use in your backtest (i.e., market or limit).

              Based on the above, is it possible to define the Futures - Simulator Commission value within Initialize()? For instance, the above ES example would be $21.25, but a similar CL backtest would be $2.50 + (3 ticks * $10/tick)/2 = $17.50. Therefore, to run an ES backtest and then a CL backtest, one would need to remember to go back into the Futures - Simulator option and change the Commission value from $21.25 to $17.50. Instead, would it be possible to just have an if or switch statement that set the Commission value within the code so that you would not have to go to the extra step of clicking through screens to change the Commission value?

              Thanks,

              Aventeren
              Last edited by aventeren; 02-24-2014, 09:11 AM.

              Comment


                #22
                Hi Aventeren,

                It is not possible to set the commission amounts using code.
                However, I will submit a feature request in your behalf to our development department for this.

                Thank you for your feedback and suggestions. We value your opinions and they will be considered in our feature discussion for a future NinjaTrader release.

                I did want to mention that it would seem odd to me to apply slippage to a limit order. A limit order would not be affected by slippage. However, the idea sounds good.
                Chelsea B.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                4 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                40 views
                0 likes
                Last Post alifarahani  
                Started by Waxavi, Today, 02:10 AM
                1 response
                18 views
                0 likes
                Last Post NinjaTrader_LuisH  
                Started by Kaledus, Today, 01:29 PM
                5 responses
                15 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Working...
                X