So any resolution for this ?
thanks
Alert on Day Interval Chart [SOLVED]
For the sample code i posted,If you set up the alert type to Intra bar it will keep alerting every time the condition is met and this may happen several times inside a bar. To make it alert once when the condition is met you need to select On close alert type or rewrite the code so that it will alert once when the condition is met inside a bar.I have enable alerts and also set alert type to intra bar. I also enabled update every tick for the indicator.
I would like to to alert immediately when the condition occurs and only alert it once.
The problem now is that once the condition is satisfied, it keeps alerting.
if high>high[1] then
alert("Break previous day high");
how do i change it such that it will alert once when the condition is met inside a bar ?
As already mentioned, i am applying it to a 1 Day interval chart.
thank you.
Please try this code:
Input : condition(high>high[1]), alert_message("alert");
var : intrabarpersist _is_alerted_on_this_bar(false), intrabarpersist _currentbar(0);
if _currentbar<>currentbar then begin
_is_alerted_on_this_bar=false;
_currentbar=currentbar;
end;
if condition and not _is_alerted_on_this_bar then
begin
alert(alert_message);
_is_alerted_on_this_bar=true;
end;
Input : condition(high>high[1]), alert_message("alert");
var : intrabarpersist _is_alerted_on_this_bar(false), intrabarpersist _currentbar(0);
if _currentbar<>currentbar then begin
_is_alerted_on_this_bar=false;
_currentbar=currentbar;
end;
if condition and not _is_alerted_on_this_bar then
begin
alert(alert_message);
_is_alerted_on_this_bar=true;
end;