FxNewbie Posted February 18, 2013 Report Posted February 18, 2013 (edited) 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 February 18, 2013 by FxNewbie
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now