Hi all, I have this code below that is meant to fire an alert whenever a new S/R level is created. The problem I am having is that the alert fires over and over again, and I would like for it to only fire once. I figure the easiest way to solve this issue would be to take the value of the S/R level being created and add it to an array. The alert function could then check to see if the S/R level already exists in the array before firing.
Am I on the right track or is there another way to do this? Any help would be greatly appreciated.
void UpcomingTradeAlert(int tp_0, int tp_4) {
double newLevel = tro_211[tp_0][tp_4];
// need to add the value of newLevel to an array
if ( // array needs to be checked to see if value of newLevel has already been added before launching alert ) {
Alert("New S/R Level Created");
}
}
Place a counting in your indicator
Use an Array, one entry for each level, and use a value for each level to tell you if it has been Alerted or not.
Thanks RaptorUK - that's what I figured. But I am a total newbie when it comes to MQL4 so I'm not really sure how to code that.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, I have this code below that is meant to fire an alert whenever a new S/R level is created. The problem I am having is that the alert fires over and over again, and I would like for it to only fire once. I figure the easiest way to solve this issue would be to take the value of the S/R level being created and add it to an array. The alert function could then check to see if the S/R level already exists in the array before firing.
Am I on the right track or is there another way to do this? Any help would be greatly appreciated.
void UpcomingTradeAlert(int tp_0, int tp_4) {
double newLevel = tro_211[tp_0][tp_4];
// need to add the value of newLevel to an array
if ( // array needs to be checked to see if value of newLevel has already been added before launching alert ) {
Alert("New S/R Level Created");
}
}