Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Highs[1][0] in Multiple timeframes in Replay mode

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

    Highs[1][0] in Multiple timeframes in Replay mode

    Hello,

    I'm developing a strategy on 5 Minutes bars as primary and I'm adding 60 minutes bars for trend validation.

    However, I've noticed that when I download Market Replay data (Level 1) and run my strategy over it, I get the same values all the time on my 60 minutes bars.

    I'm testing the 60 bars on every tick on my 5 minutes bar.
    I've also tried to test the 60 minutes bars only when BarsInProgress == 1... same result.

    my code looks like:

    Code:
    protected override void Initialize()
    {
    	Add(PeriodType.Minute, 60);
            CalculateOnBarClose = false;
    }
    
    protected override void OnBarUpdate()
    {
    	if(BarsInProgress != 0) return;
    	try
    	{
    		bool? isUp = CheckTrend();
    	...
    	}
    	catch(Exception ex)
    	{
    	...
    	}
    
    }
    
    private bool? CheckTrend()
    {
    	return CheckTrend(0);
    }
    
    private bool? CheckTrend(int index)
    {
    	if(index+1 >= Highs[1].Count) return null;
    	
    	bool isUp = Highs[1][index] > Highs[1][index+1];
    	bool isDown = Lows[1][index] < Lows[1][index+1];
    	Print(string.Format("high[0]: {0}, high[1]: {1}, low[0]: {2}, low[1]: {3}", Highs[1][0], Highs[1][1], Lows[1][0], Lows[1][1]));
    	if(isUp && isDown) return null; // Current bar broke up & down
    	if(!isUp && !isDown) // Current bar is inside bar
    	{
    		return CheckTrend(index+1);
    	}
    	return isUp; // Current bar broke either up or down the previous bar
    }
    I would appreciate your help on that.
    Regards,
    Eyal.
    Last edited by esafran; 08-19-2011, 07:44 AM.

    #2
    esafran, welcome to the forums here, are you sure the CalculateOnBarClose is still set to false from the UI as you enable / start the strategy in replay? Please also that it would only apply to the replayed chart portion of the chart and not any historical backfill data where your strategy in run on.

    Comment


      #3
      Thank you for your reply,

      are you sure the CalculateOnBarClose is still set to false from the UI as you enable / start the strategy in replay?
      Yes, I have checked also in the UI screen, the CalculateOnBarClose is also set to False there.

      Please also that it would only apply to the replayed chart portion of the chart and not any historical backfill data where your strategy in run on.
      I figured it, that is why I start my replays data from 09:00 and not from 07:00 as it defaults to, so I would have at least 2x 60 min bars...

      I downloaded all the week, day by day from the 8/8/11 till 8/12/11 and when I run my strategy, I get the same values in the Highs[1][0] & Lows[1][0] even when a new hour bar is open.

      Regards,
      Eyal.

      Comment


        #4
        Please give this simple strategy a run on your replay chart, it adds a 60 min series as well and prints then for both BIP's.

        Also note the high would stay constant for quite some time and not developing, for example if the hourly candles has seen it's high and not the range is expanded lower.
        Attached Files

        Comment


          #5
          The Primary indeed changed....
          the Secondary remained: Secondary BIP 0 1.4315, even when:
          the 09:00 bar reached 1.4370 and the 10:00 bar is now on: 1.4388.

          for some reason, that Highs do not change...
          I've tried to download again the data for 8/8/11, same result.

          Eyal.

          Comment


            #6
            What session templates are you running this on for both series? For example if you have a template where the session starts on the half hour, you would not see a new bar at 900, but 930.

            Comment


              #7
              What session templates are you running this on for both series?
              CME FX Futures ETH.

              Comment


                #8
                I also just tried to:
                1. delete the db folder under my Documents folder.
                2. Launch the Ninja Trader again (NinjaTrader 7.0.1000.7)
                I tried both the 32 bit & 64 bit (my OS is 64 bit).
                3. Downloaded the Replay Data again for 6E 09-11 at 08/08/11
                4. I started the script you gave me at 07:00...

                The Highs[1][0] were updating until 09:00 but then they froze at Secondary BIP 0 1.4315 even though the current 60 min bar, broke it up...

                Eyal.

                Comment


                  #9
                  OMG!!! i'm such a noob...

                  I didn't know I had to add the 60 min Data Series on the same chart with the 5 min...
                  I thought it was enough that I had a 60 min different windows open on my desktop...

                  I added the 60 min data series on the chart your strategy is on, and it works fine...

                  Thank you very much for your help.
                  Eyal.

                  Comment

                  Latest Posts

                  Collapse

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