Alert on Day Interval Chart  [SOLVED]

Questions about MultiCharts and user contributed studies.
Guest

  [SOLVED]

Postby Guest » 22 Jan 2007

So any resolution for this ?

thanks

Guest

Postby Guest » 24 Jan 2007

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 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.


For the sample code i posted,

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.

User avatar
Kate
Posts: 758
Joined: 08 Dec 2006

Postby Kate » 25 Jan 2007

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;


Return to “MultiCharts”