Multiple checks on specific hour

 
I'm new to this and I can't figure out why a specific hour is being checked more than one time.
I added this:

if (TimeHour(Time[2]) == 15 && TimeMinute(Time[2]) == 45)
Print("Test!");

I set the period to "M15"

and the "Test!" statement is printed more than one time.

Why is this happening?
 
vushel: the "Test!" statement is printed more than one time.
How many ticks will there be in the one minute between 15:45 and 15:46?
 
I'm not sure.
How can I know?
 
vushel:
I'm not sure.
How can I know?
Look at the "volume" (tick count) on the specific M1 bar.
 
The volume of the bar of 15:45 is 2692.
 
vushel:
The volume of the bar of 15:45 is 2692.
That seems a lot for an M1 bar . . .  but that is 2692 ticks,  and for each of those ticks start() is called.
 
It's 2692 for a M15 bar.
Sorry, I misunderstood and checked the M15.
 
vushel:
It's 2692 for a M15 bar.
Sorry, I misunderstood and checked the M15.
Nevermind,  you get the idea,  for each tick  the start() function is called. 
 
Yes, I get this.
But what I don't get, is why this volume thingy exists.
Why do I need it to check 2692?
I want my code will occur only once for each 15 minutes.
 
vushel:
Yes, I get this.
But what I don't get, is why this volume thingy exists.
Why do I need it to check 2692?
I want my code will occur only once for each 15 minutes.
OK,  so check when a new M15 bar has arrived and check then,  cheeking once per bar has been disused many times,  use the search top right of this page.
 

I thought that this code would do the job:

 

      // Execute on bar open
                if(CheckOncePerBar)
                {
                                int BarShift = 2;
                                if (Time[0] != CurrentTimeStamp)
                                {
                                                CurrentTimeStamp = Time[0];
                                                bool NewBar = true;
                                }
                                else
                                {
                                  NewBar = false;
                                }
                }
                else 
                {
                        NewBar = true;
                        BarShift = 0;
                }