multi timeframe alert once

 

I have this alert set to tell me about other timeframes.

However, because of the Time[0] setting, when I am on a 5min chart, it is alerting me about the Daily chart every 5mins instead of just once.

How can I add a period time to the setting so it alerts me only once for daily, only once every 4hrs if something happens on the 4hr, etc:


[code]

if (iLow(Symbol(),period[x],1) < iLow(Symbol(),period[x],2) &&
iLow(Symbol(),period[x],1) < iLow(Symbol(),period[x],3) &&
iLow(Symbol(),period[x],1) < iLow(Symbol(),period[x],4) &&
iLow(Symbol(),period[x],1) < iLow(Symbol(),period[x],5) &&
iLow(Symbol(),period[x],1) < iLow(Symbol(),period[x],6) &&
iClose(Symbol(),period[x],1) > iOpen(Symbol(),period[x],1) &&
GlobalVariableGet(Symbol()+period[x]+"DDCandleLastAlert") < Time[0]
)
{
if (Period() != PERIOD_M1){
Alert ("divergent candle on "+Symbol() + " " + period[x]);}
GlobalVariableSet(Symbol()+period[x]+"DDCandleLastAlert", Time[0]);
}

[/code]


For example, how can I use Time[0] for the Daily timeframe when the 5min timeframe is open and have it alert once for the day instead of every 5mins?

how can I use Time[0] for the 4hr timeframe when the 30min timeframe is open and have it alert once every 4hrs instead of once every 30mins?

Reason: