For a non-Wizard formula, I want an alert to occur only once per bar, the first time the alert condition is met in any bar. For a Wizard formula, with alerts setup in the "happen only the first time" section, the same is accomplished by adding this to the main section:
if (getBarState() == BARSTATE_NEWBAR) {
vLastAlert = -1;
}
When I add that to a non-Wizard formula, I don't get the same result. A sound alert, for example, plays every time the condition is met, not just once per bar. Tried removing those lines, and still the alert plays every time the condition is met. What do I need to do here?
if (getBarState() == BARSTATE_NEWBAR) {
vLastAlert = -1;
}
When I add that to a non-Wizard formula, I don't get the same result. A sound alert, for example, plays every time the condition is met, not just once per bar. Tried removing those lines, and still the alert plays every time the condition is met. What do I need to do here?
Comment