Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Mixed time frames

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

    Mixed time frames

    Hi,

    I want to go long the mini-Dow if the Dow Cash closes down today compared with the previous day. Easy - Closes[1][0] < Closes[1][1]. The mini-Dow is the main instrument in the strategy.

    If I base the strategy on YM minute bars and wait for after 16:00 EST, the Dow is as of the previous day since Ninja assumes that is the data I want to look at. Obviously, I can't access Closes[1][-1] as the array will not hold that data.

    Would this work if I based the strategy on daily DJIA and Add(ed) 1-minute YM bars or would it look to tomorrow ?

    Alternatively, could I cheat and create 1-minute DJIA data which was actually the day close -

    20080228 160000;12689.28;12713.99;12463.32;12582.18;3938580
    20080229 160000;12579.58;12579.58;12210.3;12266.39;4426730

    Thanks,
    Eric
    Last edited by cherriman; 03-05-2008, 11:07 AM. Reason: Typos

    #2
    Hi Eric,

    Be patient with me as I try to understand what you want to do...

    - You want to go long as the Cash index close of today is less than yesterday
    - You want to check this condition today after 16:00 EST

    Is this correct? If yes, what are your session start/end times going to be?
    RayNinjaTrader Customer Service

    Comment


      #3
      Hi Ray,

      That was quick !

      You have it exactly right; if today's Cash close is below yesterday's, I want to go long the mini-Dow. I want to check this as at the Cash close (i.e. just after 4 o'clock). There are obviously certain other conditions !

      I'm not sure what you mean by session start/end times so that is probably a big clue ! The position will be held from 16:00EST until it is either stopped out or hits a profit target - this could be any time throughout the night. Sorry to be a thickie - I hope that answers your question albeit indirectly.

      Thanks,
      Eric

      Comment


        #4
        Thanks.

        Assuming DOW Mini 1 Minute is the primary series and the Daily series is added in Initialize() can you clarify why this would not work:

        Code:
        if (BarsInProgress == 0)
        {
            if (Closes[1][0] < Closes[1][1] && ToTime(Time[0]) > 160000)
                EnterLong();
        }
        RayNinjaTrader Customer Service

        Comment


          #5
          Ray, I haven't tried your code - mine was within OnBarUpdate() - would that make a difference ?

          The condition I had was
          if ((Closes[1][0] < Closes[1][1]) && (ToTime(Time[0]) > ToTime(16, 00, 0)) && (ToTime(Time[0]) < ToTime(16, 10, 0))).

          When I do a debug PrintWithTimeStamp, I get
          03/01/2008 16:01:00 Pos Flat Dow cl 13043.96 prev 13264.82

          13043.96 is the closing price of the 2nd of January, not the 3rd.

          Thanks,
          Eric

          Comment


            #6
            My code is for OnBarUpdate()

            Not sure I follow...

            If you do this:

            Code:
            if (BarsInProgress == 0)
                Print(Time[0].ToString() + " " + Closes[1][0])
            I would expect that you get the close price of daily bars of the time stamp you printed out. Is this not the case?
            RayNinjaTrader Customer Service

            Comment


              #7
              Hi Ray,

              Tried driving this from both daily and minute perspective - I suspect that Close[0] for daily is updated at midnight ?

              Here it the output from the debug code running the strategy as of 21st Feb 2008 -

              29/02/2008 16:01:00 Pos Flat Dow cl 12582.18 prev 12694.28

              This is the actual data
              20080227;12683.54;12815.59;12527.64;12694.28;3904700
              20080228;12689.28;12713.99;12463.32;12582.18;3938580
              20080229;12579.58;12579.58;12210.3;12266.39;4426730

              As you can see, on the 29th, Ninja assumes day 0 to be yesterday even after 16:00 EST.

              I've attached my zipped strategy; I would be grateful if you could help.

              Thanks,
              Eric
              Attached Files

              Comment


                #8
                Thanks. This is a limitation of NT 6.5 right now. Could you try running the strategy on a daily chart with the secondary series being the 1 minute.

                Then in OnBarUpdate() just only process events for the 1 minute.

                if (BarsInProgress == 1)
                // Process logic

                Is the daily bar now pointing to the correct day?
                RayNinjaTrader Customer Service

                Comment


                  #9
                  Ray,

                  I don't know if I'm doing something wrong but NT is evaluating the YM price in Close[x] using the code you suggested !

                  I'm running the strategy against ^DJIA.

                  Close[x] points to YM
                  Closes[x][y] points to YM !

                  Eric

                  Comment


                    #10
                    Right.

                    Should be:

                    Close[x]
                    Closes[y][x]
                    RayNinjaTrader Customer Service

                    Comment


                      #11
                      Ray,

                      That refers to data one bar further back so I'm afraid we're going the wrong way !

                      By the way, I had assumed that Close[0] would refer to Closes[0][0] - is that incorrect ?

                      Thanks,
                      Eric

                      Comment


                        #12
                        To be clear:

                        - Apply strategy on daily chart
                        - Strategy has a minute series added via Add() in Initialize()

                        Code:
                        if (!Historical && BarsInProgress == 1)
                            Print(Times[0][0].ToString() + " " + Closes[0][0]);
                        RayNinjaTrader Customer Service

                        Comment


                          #13
                          If that should be within OnBarUpdate() it produces no output at all.

                          Comment


                            #14
                            That would be the case if you were backtesting...

                            I ran a few tests here and I don't think this is the route we should go down. We have internal limitations (which we will change later this year) in when the close of a daily bar is recognized from an intraday time frame.

                            What you can do is use the GetSessionBar() method which will create a virtual session bar based on your intraday data.

                            RayNinjaTrader Customer Service

                            Comment


                              #15
                              Ray,

                              As far as I can tell from the tests I've run, the close of the daily bar doesn't occur until midnight - 8 hours after I want to test the strategy.

                              Can I cheat by setting up a set of minute data for the Dow cash which is just the close - e.g.

                              20080228 160000;12689.28;12713.99;12463.32;12582.18;3938580
                              20080229 160000;12579.58;12579.58;12210.3;12266.39;4426730

                              Would that work do you think ?

                              Eric

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                              0 responses
                              596 views
                              0 likes
                              Last Post Geovanny Suaza  
                              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                              0 responses
                              343 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by Mindset, 02-09-2026, 11:44 AM
                              0 responses
                              103 views
                              0 likes
                              Last Post Mindset
                              by Mindset
                               
                              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                              0 responses
                              556 views
                              1 like
                              Last Post Geovanny Suaza  
                              Started by RFrosty, 01-28-2026, 06:49 PM
                              0 responses
                              554 views
                              1 like
                              Last Post RFrosty
                              by RFrosty
                               
                              Working...
                              X