Island top event
Marks a down gap that closes an up-gap island, the island-top sign. In this code it fires at most once.
The pattern tracks gaps between consecutive candles. An up gap is a candle whose low sits more than the gap fraction above the prior candle's high, and the first one starts an island state. The marker fires on a down gap, where the high sits more than the gap fraction below the prior low, but only when that down gap lands on the island_bars-th candle of the island, counting the up-gap candle as the first. The island state never returns to idle, so this can happen only once from the start of the data.
How to read it
- Markers sit on the candles where a down gap happens: the high is more than the gap below the prior low.
- By default that is the third candle of the island, counting the up-gap candle as the first.
- Only the first up gap in the data starts an island, so markers are very rare.
- A month of SPY one-minute bars at defaults produced none; treat a marker as an unusual event.
What it outputs
- Island top
- Marks the candle where a down gap closes an up-gap island. The island state never resets to idle, so this marks at most one candle from the start of the data.
When it fires
Fires on a down gap that lands on the island_bars-th candle of the island, counting the first up-gap candle as one. Meaning: price gapped up, then gapped back down, the intended island-top reversal sign. The island state never resets, so this happens at most once in the data.
Settings
- gap
- Minimum gap as a fraction of price (0.01 = 1%). Raising it demands bigger gaps, so markers get rarer. Lowering it toward 0 counts plain non-overlapping candles as gaps. Negative values make both gap tests true nearly everywhere, so keep it at 0 or above.
- island_bars
- Bars in the island, with the up-gap candle as bar 1. The down gap must land on exactly this candle, so higher values make a match rarer. At 1 it cannot fire with a gap of 0 or more, since one candle cannot gap both ways.
Pitfalls
- Looks broken: the island state has no exit back to idle, so after the first up gap the marker can fire at most once from the start of the data.
- At the 1% default, gaps are rare on one-minute bars; a month of SPY produced zero markers, so the default is effectively off.
- The presets only change how easily the first gap and the down gap line up; the once-only limit holds at every setting.