Example: Ichimoku Lagging Span Bollinger Bands Crossover

In this example we will be creating an indicator that triggers when the Ichimoku Lagging Span (Chikou Span) crosses the upper Bollinger Band. First, we will need to dive a little bit into the theory behind it all.

For Ichimoku, given a candle at a certain time T, the Lagging Span (=Chikou Span) at time T is defined as the closing price of the candle at time T+26. Alerts are all evaluated using the latest candle, at time T=now. But, at time T=now the Lagging Span is not known yet, as you would need to look into the future (the close of T=now+26) to obtain the value of the Lagging Span. Therefore, when we require that the Ichimoku Lagging Span crosses the upper Bollinger Band, that is actually a requirement on a historic candle that occured 26 candles ago.

With the above theory, we can start formulating our approach:

  • First, we will take value of the upper Bollinger Band 26 candles ago.
  • Second, we will take the value of the Lagging Span 26 candles ago — but, given the definition of the Lagging Span, that equals the closing price of the current candle.
  • Then, we will compare those two values: if the Lagging Span exceeds the Bollinger Bands our condition matches and the alert should fire.

The above can be scripted as follows:

FIRST EXPRESSION (A)
Lookback
N 26
4 hours
of: Bollinger: Upper Band
Length20
K2
COMPARISON OPERATOR
<>=ƒ
SECOND EXPRESSION (B)
4 hours
Candlestick: Closing Price
Length14