Ok, so I tested this on a tick chart to make sure it was not being caused by the EquiVolume. The same thing happens on tick charts so we know there is an issue and we can address it. The problem is that for any expansion bars (empty chart space to the right of the last bar), the value of the seconds
variable is zero. Your alert is set to check if the current value of seconds
is the lowest values in 11 bars. So obviously when seconds
equals zero this is going to be true.
So we need to modify the seconds
variable, to ensure it does not plot into the right expansion area of the chart. We do this using: !IsNaN(close)
.
Here is the corrected code (minus the excessive abbreviation you included in yours):
declare lower;
def barTime = GetTime() / 1000; # converts time to seconds
def seconds = if !IsNaN(close) then barTime – barTime[1] else Double.NaN; # number of seconds between bars
plot alertPeriod = seconds < Lowest(seconds[1], 11);
Alert(alertPeriod, “climax bar!”, Alert.BAR, Sound.Chimes);
In order to answer this you are going to to have to explain exactly how that chart is constructed. The candles on this chart are not normal. Some are wider than others and they all have shading that is not easily explained. Is this an EquiVolume chart?
Equivolume 400 tick charts