alert only 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]

 
SanMiguel wrote >>

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]

add a counter for alert

 
Temp1234:

add a counter for alert

but it's not a flag, if it alerts today for example, I don't want it to alert again until tomorrow.

4hr, alert once, then wait 4hrs.

1hr, alert once then not again for another hour.


This works fine when the timeframe is set to that timeframe as Time[0] picks up the daily Time[0].

 
SanMiguel:

but it's not a flag, if it alerts today for example, I don't want it to alert again until tomorrow.

4hr, alert once, then wait 4hrs.

1hr, alert once then not again for another hour.


This works fine when the timeframe is set to that timeframe as Time[0] picks up the daily Time[0].

How can I use the actual period Time instead of Time[0] ?

 
anyone?
 

int BarsTotal; //declare it as a public variable in the parameters section


if (Bars>BarsTotal || BarsTotal==0)

{

Alert ("divergent candle on "+Symbol() + " " + period[x]);}
GlobalVariableSet(Symbol()+period[x]+"DDCandleLastAlert", Time[0]);
BarsTotal=Bars;

}

 
Temp1234:

int BarsTotal; //declare it as a public variable in the parameters section


if (Bars>BarsTotal || BarsTotal==0)

{

Alert ("divergent candle on "+Symbol() + " " + period[x]);}
GlobalVariableSet(Symbol()+period[x]+"DDCandleLastAlert", Time[0]);
BarsTotal=Bars;

}

But if I am on the 5min timeframe, it will count the number of 5min bars?

Will it not still alert me every 5mins for the if test on the Daily chart?