Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

What are the problems with backtesting?

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

    #16
    I understand....But why does Ninjatrader allow me to get instantly filled at 2 prices that are 2 ticks apart? Shouldn't the backtester not allow that regardless of what my code tries to do?

    Comment


      #17
      Originally posted by Baruch View Post
      Hi Jeff,
      You need to run it on a smaler chart, so your exits would be not on the same bar. You can get your trigers from the current chart.

      Baruch
      In my strategy I am looking at the last 5-10 bars to determine an entry trigger. If I reduced the bar size from 3500 ticks then my triggers would be different. And how would I know how small to make the chart when even on a 100 tick chart it could sometimes trade 3 prices?

      Comment


        #18
        It seems the historical tick data contains a price change of two ticks within a second.

        Comment


          #19
          It is impossible that in all of the trades there were 3 prices traded in 1 second. So there has to be something wrong....

          Are my ticks in the right format?

          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;19
          20100301 085253;1110.25;1
          20100301 085253;1110.25;7
          20100301 085253;1110.25;10
          20100301 085253;1110.25;2
          20100301 085253;1110.25;2
          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;2
          20100301 085253;1110.25;1
          20100301 085253;1110.25;25
          20100301 085253;1110.25;1
          20100301 085253;1110.25;1
          20100301 085253;1110.25;42
          20100301 085253;1110.25;2
          20100301 085253;1110.25;2
          20100301 085253;1110.25;2
          20100301 085253;1110.25;2
          20100301 085253;1110.25;4
          20100301 085253;1110.25;21
          20100301 085253;1110.25;1
          20100301 085253;1110.25;5
          20100301 085253;1110.25;5

          Comment


            #20
            Please note that we are not a data feed provider. What source did you use for historical data during the backtest?

            Ok, I now see that the strategy triggered 1000 separate trades. Do you have 2 ticks profit for each trade or do some trades have zero or one tick in profit?

            Comment


              #21
              I have access to my own tick database that I converted to Ninja ticks. I do not use a data provider.

              My profit target is 2 ticks so all of my winners are 2 ticks. There is a stop loss so the loser is 11 ticks. The only other exit condition is 8-16 bars pass, which hasnt happened.

              Here is what it looks like:





              Comment


                #22
                Unfortunately I am not sure why all trades exit the same second as per the conditions you setup.

                Since the entry and exit price are listed for the same second, it would indicate the historical data has it listed this way.

                What happens if you run the strategy in a chart when connected to the Simulated Data Feed? Does it enter and exit the same second as well?

                Comment


                  #23
                  Hi Jeff,
                  If I reduced the bar size from 3500 ticks
                  1. If your Time Period is 3500 ticks, so each bar is made of 3500 ticks Each bar has only one time - its end time, so if you enter and exit on the same bar you have the same TS for entry and exit.
                  2. If your PT is 2 ticks you need to run it on 1 tick TF!

                  Baruch

                  Comment


                    #24
                    When I run it on simulated data not all trades are on the same bar. Was my tick format correct? My data works fine when just looking at charts.

                    Ok I understand why the timestamps would be messed up. However that does not explain the profit being messed up. If I enter on a bar with a limit order and then go for 2 ticks of profit, will it fill be if at any time on that bar, the profit was hit? Even if that happens before my entry is filled?

                    PT is what? Period of time?
                    TF is what? Time Frame?

                    Why do you need to run it on 1 if PT is 1?

                    What I am doing is I am looking for the trend on the past few bars and then I am sending a limit order off of the market in an attempt to buy a pullback or sell a pop. Once I get filled I am going for 2 ticks with a stoploss of 5 ticks. So everytime I get filled, the same bar is guaranteed to contain my cover price (since I am buying a pullback). Could this cause an issue?
                    Last edited by jeffbg123; 03-03-2010, 02:22 PM.

                    Comment


                      #25
                      PT - Profit Target
                      You need to run it on a one tick TF(Time frame). You can reference 3500T TF and make your entry decisions on it.

                      Baruch
                      p.s.
                      You still can have slippage on the exit. (On SL)

                      Comment


                        #26
                        So when I am in the backtest menu, for data series I choose type = tick and value = 1. How do I then reference 3500 tick bars in the code? I am currently just using High[0], High[1], etc...

                        Thanks
                        -Jeff

                        Comment


                          #27
                          You need to program your strategy as a multi-time frame strategy then: http://www.ninjatrader-support.com/H...ameInstruments
                          Josh P.NinjaTrader Customer Service

                          Comment


                            #28
                            So Ninjatrader does not support entry and exit on the same bar?

                            When I try to run the Add() function I get

                            Failed to call 'Add' method for period type 'Tick': Exception of type 'System.Out.OfMemoryException'

                            I dont think it even goes through a single bar?
                            Last edited by jeffbg123; 03-03-2010, 04:27 PM.

                            Comment


                              #29
                              What do you mean by entry and exit? Are you just trying to reverse your position? If so just place an entry order in the opposite direction and it will reverse you. If you are asking about entering at open and closing somewhere inside that bar, you don't have that granularity in a backtest. Backtesting runs off of snapshot data based on bar's OHLC. You have no information inbetween each bar.

                              Reason you ran out of memory is because running a 1 tick series is extremely taxing on the system and doing so should only be used on a few days only.
                              Josh P.NinjaTrader Customer Service

                              Comment


                                #30
                                I am entering and then closing a position when I hit my 2 tick profit or 11 tick stoploss. Then I wait for another trigger and enter again.

                                I understand the OHLC part and see that this is why 1 tick bars are necessary.

                                However I tried running it on 1 tick bars with "Add(PeriodType.Tick,3500);" And in my On bar update I put:

                                if(BarsInProgress == 1)
                                {
                                Print("3500 bar");
                                }

                                This print statement was never printed to the output window. I did not get any log messages.

                                What could be wrong?

                                Comment

                                Latest Posts

                                Collapse

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