Jump to content

Help about an alert


FxNewbie

Recommended Posts

My problem is the pop-up alert happens one time only and will not pop-up an alert for the next cross. Can anyone point out to me how I can solve this problem?

 

The TimeCurrent()-PrevAlertTime being > Period()*60 is to prevent multiple alerts when the signal is true. It certainly does stop multiple alerts but I need to get fresh alerts popping up.

 

 

I have these declared variables:

extern bool Alert_Cross = true;

datetime PrevAlertTime=0;

 

and this is the code for the alert

if (Alert_Cross == true)

{

if((Cross_Status == 1) && ((TimeCurrent() - PrevAlertTime) > Period()*60))

{

Alert("LONG Cross");

PrevAlertTime=TimeCurrent();

}

else if((Cross_Status == -1) && ((TimeCurrent() - PrevAlertTime) > Period()*60))

{

Alert("SHORT Cross");

PrevAlertTime=TimeCurrent();

}

}

Edited by FxNewbie
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...