lndshrk
Member
- Joined
- Jun 13, 2019
- Posts
- 13
- Likes
- 2
I have the following code in which I set the Signal flag to True after an alert condition is met. However, I'm still occasionally getting multiple alerts when real time updates are enabled.
Any ideas why the flag doesn't stay "True" and allows the alert to fire again?
if( crossedAbove(series, i, Val.SMI1, smiThresUP)
&& !series.getBoolean(i, Signals.smiPullback, false)) //checks to see if a signal has already fired.
{
series.setBoolean(i, Signals.smiPullback, true); //set the Signal to true
Double bottom = round(series.getHigh(i));
Coordinate c = new Coordinate(series.getStartTime(i), bottom);
MarkerInfo marker = getSettings().getMarker(smi_PULLBACK_MARKER);
String msg = get("SMI Pullback", series.getLow(i), format(series.getClose(i)));
if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker, msg));
ctx.signal(i, Signals.smiPullback, msg, round(series.getLow(i)));
}
Any ideas why the flag doesn't stay "True" and allows the alert to fire again?
if( crossedAbove(series, i, Val.SMI1, smiThresUP)
&& !series.getBoolean(i, Signals.smiPullback, false)) //checks to see if a signal has already fired.
{
series.setBoolean(i, Signals.smiPullback, true); //set the Signal to true
Double bottom = round(series.getHigh(i));
Coordinate c = new Coordinate(series.getStartTime(i), bottom);
MarkerInfo marker = getSettings().getMarker(smi_PULLBACK_MARKER);
String msg = get("SMI Pullback", series.getLow(i), format(series.getClose(i)));
if (marker.isEnabled()) addFigure(new Marker(c, Enums.Position.TOP, marker, msg));
ctx.signal(i, Signals.smiPullback, msg, round(series.getLow(i)));
}