well, if you read your comments, you will have the answer
zzuegg:
well, if you read your comments, you will have the answer
well, if you read your comments, you will have the answer
Yes, but how do I get it to check on every tick?
Should I add the Bid>Bands part to this section:
if (Time[0] > MostRecentBarStart) so: //Alerts // See if this bar is new if ( Time[0] > MostRecentBarStart && ((Bid >= iBands(Symbol(),NULL, 20, Sigma, 0, PRICE_CLOSE, MODE_UPPER, 0)) || (Bid <= iBands(Symbol(),NULL, 20, Sigma, 0, PRICE_CLOSE, MODE_LOWER, 0)) ) ) { // Store the time of the current bar, preventing further action during this bar MostRecentBarStart = Time[0]; PlaySound("button-8.wav"); }
// See if this bar is new and conditions are met static datetime MostRecentBarStart=0; if (Time[0] != MostRecentBarStart && ((Bid >= iBands(Symbol(),NULL, 20, Sigma, 0, PRICE_CLOSE, MODE_UPPER, 0) || (Bid <= iBands(Symbol(),NULL, 20, Sigma, 0, PRICE_CLOSE, MODE_LOWER, 0) ) ) { // Store the time of the current bar, preventing further action during this bar MostRecentBarStart = Time[0]; PlaySound("button-8.wav"); }should work...
zzuegg:
should work...
should work...
Can I set this at bthe top of the indicator?
static datetime MostRecentBarStart=0; if it's in the start() code, won't it be reset every tick?
hi,
if you declare the variable as static is not reset every tick, for that reason is static.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Does this code only check the Bid > Bands at the first tick of each bar?
I want the alert to sound once but for the code to be checked on every tick during the bar: