Repetitve emails in realtime when using send email function

I have been trying to use send email function to send customised emails as alerts . The problem is when i run it in realtime it sends out repetitive emails of the same alert . I use the below code .

barcomplete = BarIndex() < LastValue(BarIndex());

if(LastValue(Ref(targets,-1)) AND barcomplete )

{

sendemail("text")'

}

how can i avoid sending out multiple emails for the same alert by using the send email function ?

Warm Regards

Jatin

When posting the formula, please make sure that you use Code Tags (using </> code button) as explained here: How to use this site.

Using code button

Code tags are required so formulas can be properly displayed and copied without errors.

@aditisingh you could probably adapt the code sample I posted some time ago in this past thread.

Essentially, the main idea was to avoid repetitive alerts in a short sequence, and the solution is originally from the Say() function example; it uses a StaticVar to ignore redundant vocal messages. You can apply the same logic to avoid sending multiple emails.

You are calling SendEmail multiple times YOURSELF, so it does what you told it to do.

You should be using AlertIF function that automatically prevents sending repetitive alerts of the same type
http://www.amibroker.com/f?alertif

Or you should prevent calling SendEmail multiple times YOURSELF as @beppe told you.

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.