Condition, if chart is daily or H4 do this ?

 
How do I determine that the condition of the chart is daily data ?
 
if(Period()==PERIOD_D1)
Reason: