Hello Everyone,
I tried to modify Stochastic to pop-up only alert one time at over-brought or Over-Sold Level. But again getting same error,
Hi,
My suggestion is to move the alert code into a separate function. Something like:
void AlertMe(datetime barOpenTime, string msg) { static datetime prevAlertTime = TimeCurrent(); if(barOpenTime <= prevAlertTime) return; prevAlertTime = barOpenTime; Alert(_Symbol," "+msg); }
Next, substitute the "main cycle" code block with the following:
//--- main cycle for(i=start;i<rates_total && !IsStopped();i++) { double sumlow=0.0; double sumhigh=0.0; for(k=(i-InpSlowing+1);k<=i;k++) { sumlow +=(close[k]-ExtLowesBuffer[k]); sumhigh+=(ExtHighesBuffer[k]-ExtLowesBuffer[k]); } if(sumhigh==0.0) ExtMainBuffer[i]=100.0; else ExtMainBuffer[i]=sumlow/sumhigh*100; // // Alert code // if(ExtMainBuffer[i] > 79.99 && ExtMainBuffer[i] < 81.00 ) AlertMe(time[i],"overbought"); else if(ExtMainBuffer[i] < 21.00 && ExtMainBuffer[i] > 19.99 ) AlertMe(time[i],"oversold"); }
Please use the </> button to insert your code.
Hii Mr. Artur Zas
Thank You so much for your reply I will check once,
Hi,
My suggestion is to move the alert code into a separate function. Something like:
Next, substitute the "main cycle" code block with the following:
Hii Mr. Artur Zas,
I wonder still It is not working, I had did the same
Hii Mr. Artur Zas,
I wonder still It is not working, I had did the same
Please check the attached version. It seems to work fine on my end.
Please check the attached version. It seems to work fine on my end.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello Everyone,
I tried to modify Stochastic, to pop-up alert only one time once indicator reach to over-brought or Over-Sold Level. But again getting same error,