Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

RTH in daily backtesting

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

    RTH in daily backtesting

    Hi,

    I have multi time frame strategies where I use 15 min and daily bars.
    I want to restrict trading hours to US RTH and get a daily chart in backtesting, however my main time frame is 15 min when trades are executed. I developed and debugged this strategy successfully. My time frame with index 0 is Daily (I need it to get daily charts), my time frame with index 1 is 15 min.

    First problem is that there is no session template for daily back testing. Why? It is very inconvinient - 'll have to restrict time programmatically.
    So added following restriction in the OnBarUpdate():

    //Check if within US RTH
    if (!(ToTime(Time[0]) >= USRTH.StartTime && ToTime(Time[0]) <= USRTH.EndTime))
    return;

    Now it works as expected entering trades within RTH. But when I look at trades in backtesting they have exit time at 4:00 AM. Why?

    Separate issue: Why when I have 15 min chart in backtesting I can't scale it up to daily? Because that would allow me to use minutes time frame and set session to RTH and then it would work properly - I checked, trades have correct time.

    Thanks.

    #2
    Hello Corrado,

    Welcome to the NinjaTrader forums! I will have someone reply to you on Monday.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_RyanM View Post
      Hello Corrado,

      Welcome to the NinjaTrader forums! I will have someone reply to you on Monday.
      NinjaTrader_RyanM,
      Thank you, I'll wait for replay...

      Comment


        #4
        corrado, thanks for the patience - what session template have you selected for the primary series you start this strategy on?

        What would you mean please with you can't 'scale' your 15 min chart up in backtesting? Have you tried replacing the daily with a 1440 min one already?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Rth

          Originally posted by NinjaTrader_Bertrand View Post
          corrado, thanks for the patience - what session template have you selected for the primary series you start this strategy on?

          What would you mean please with you can't 'scale' your 15 min chart up in backtesting? Have you tried replacing the daily with a 1440 min one already?
          NinjaTrader_Bertrand,

          How do I select primary session template when Data Series type is Day? In this case the Session Template combo box disappears in the back testing configuration box. If there is a way to select it programmatically, then please let me know.

          I plan to trade within RTH only (9:30-16:00 EST), therefore I want to preset my strategy to this time frame. 1440 min is 24 hours, but the NYSE is open for 6,5 hours. I'm not interested in after hours prices for that strategy. Also I noticed that bars in the daily chart include after hours - not what I need for RTH strategy.
          To understand the issue better, try running back test with Day as a type of data series.

          For the scaling issue - when primary bar is 15 min I get chart with 15 min (expected), but that chart I can't scale to daily, for example - the bar size combo box on the chart is disabled.

          Comment


            #6
            Rth

            NinjaTrader_Bertrand,
            I noticed, that when I create data series for the chart only and select daily period, then I CAN specify RTH and I get wanted RTH chart. I need to be able to back test against this data.
            In my opinion you have to add back the Selection session template for daily and higher period bars in backtesting and optimization. Then it wold work exactly as it does right now in charting - based on the session template selection from 24 hour bar it'll extract only selected time frame.
            Last edited by corrado; 07-12-2010, 06:14 PM. Reason: spelling

            Comment


              #7
              corrado, thanks for clarifying - unfortunately for daily bars and higher the session template applied would not have an effect - it would use whatever the provider used in recording this data - for example for our data server with ZenFire the daily bars would use the RTH template.
              BertrandNinjaTrader Customer Service

              Comment


                #8
                Rth

                Originally posted by NinjaTrader_Bertrand View Post
                corrado, thanks for clarifying - unfortunately for daily bars and higher the session template applied would not have an effect - it would use whatever the provider used in recording this data - for example for our data server with ZenFire the daily bars would use the RTH template.
                NinjaTrader_Bertrand,

                Actually what I want you do that in charts when I specify data series, as I mentioned bellow. When I create just a chart I set it daily with RTH session and I can see that bars changes properly to correspond RTH time frame comparing to daily with 24/7.
                Why doesn't your argument work in charts?
                I can provide you with screen shots if needed.

                Comment


                  #9
                  corrado, which data provider are you using in this example?
                  BertrandNinjaTrader Customer Service

                  Comment


                    #10
                    Rth

                    Originally posted by NinjaTrader_Bertrand View Post
                    corrado, which data provider are you using in this example?
                    Interactive Brokers

                    Comment


                      #11
                      corrado,

                      I am not sure how you are getting different daily bars. If you pull daily data from IB it is RTH daily bars regardless of what session template you use.

                      Please find attached with both series on the chart running with ETH session templates. When using daily, you get whatever data is presented by the data provider. IB is a daily provider that gives you the daily bars as RTH and as such even if you select ETH as the session template for the daily bars, it doesn't make a difference since that is simply not the data being provided by the data provider. You can see from the attached screenshot that RTH close is $257.30 which is the same closing price as the daily bar's close. If it were ETH daily bars (which IB does not provide) it would be a price of $258.54 instead.

                      Please clarify how you are doing this on your end.
                      Attached Files
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        NinjaTrader_Josh,

                        You're correct, IB provides historical data in RTH, I checked.
                        What confused was real time data outside RTH I was getting in Ninja charts when 24/7 session used.
                        But when RTH used then current last bar changed displaying last day RTH bar without current market data.
                        Thank you for the help!

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by Tin34, Today, 03:30 AM
                        2 responses
                        15 views
                        0 likes
                        Last Post Tin34
                        by Tin34
                         
                        Started by sastrades, Yesterday, 09:59 AM
                        2 responses
                        28 views
                        0 likes
                        Last Post brucerobinson  
                        Started by ETFVoyageur, Today, 12:52 AM
                        1 response
                        14 views
                        0 likes
                        Last Post Leeroy_Jenkins  
                        Started by lollers, Today, 03:26 AM
                        0 responses
                        10 views
                        0 likes
                        Last Post lollers
                        by lollers
                         
                        Started by aliyahany, Today, 03:16 AM
                        0 responses
                        2 views
                        0 likes
                        Last Post aliyahany  
                        Working...
                        X