Trade Only Once Per Bar on Some Timeframes, not all?

 

I am stuck trying to make my EA trade only once per bar. The complication is that I have 3 timeframes in the EA. I want to make sure that for each 1 hour bar, there is only one trade. On the higher timeframes, there can be multiple trades if their conditions remain true. How would it be best to specify the execute on 1 hour bar only, leave the Daily, 4 Hour conditions untouched?

here is my code:

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

        // Begin trade block
                if(NewBar == true)
                        {



 
If you use iTime() instead of Time[] you can specify the timeframe.
 
RaptorUK:
If you use iTime() instead of Time[] you can specify the timeframe.
Or you could only run the EA on a 1 hour chart and test in the init function that you are actually using a 1 hour chart using Period()
Reason: