Determining the actual TimeFrame in mql

 

Hello, programmers,

I wrote a simple EA that needs to work only the 4 hour chart. Would you please know how to determine the timeframe of the actual chart? Thank you very much! Pavel

 
if (Period() < 240 || Period() > 240)
   {Comment("Invalid timeframe selected\nTimeframe should be H4");return(0);}
Try the above
 
Paul_B:
Try the above


Hi, PERFECT! That was so fast, I always wonder how is it possible that there is always somebody willing to answer. Thank you a lot, your solution is what I needed!

All the best! Pavel

 

I would prefer ...

if( Period()!= PERIOD_H4 ){
    // do stuff here
}
 

Great, yes, that is what I actually used so that I understand the code easier. BTW would you please know how to check whether the Ask Manual Confirmation is checked or not?

Have a great day! Pavel

 
solator:

BTW would you please know how to check whether the Ask Manual Confirmation is checked or not?

Sorry, no idea :-(
 
dabbler:
Sorry, no idea :-(

Yes, I know, I also could not find it anywhere... Thank you anyway! Pavel
Reason: