OPEN-SOURCE SCRIPT

Educational Inidicators - Ichimoku Cloud

This indicator is part of the Indicator Educational Series, intended to help newer traders understand and interact with various indicators. The goal is to allow users to gain a stronger understanding of an indicator's underlying philosophy, and visually see how changes to an indicator's parameters affects the trades suggested by that indicator.
The scripts in this series are all open source, with the code broken up into logical section and notated so beginner users can also understand some PineScript fundamentals.
Please understand that no indicator presented in and of itself constitutes a complete trading strategy. Rather, this series is to help users determine which indicators make sense to them, and which ones to combine to create their own trading strategy. All material presented is purely for educational purposes.


Presented here is the Ichimoku Cloud.

The Ichimoku Cloud was developed by Goichi Hosada, and first published in the late 1960s. It is used by traders to understand price momentum, and help forecast future price movements.

The indicator at its core can be understood from four component parts:
  • The Conversion Line - An average of the highest and lowest price in a given window. Typically, this is a "fast" average, and as such, this line has the lowest period
  • The Base Line - An average of the highest and lowest price in a given window. This is a "slower" average than the Conversion Line, and as such should have a larger period than the Conversion Line
  • Leading Span A - The average of the Conversion Line and the Base Line
    [*}Leading Span B - An average of the highest and lowest price in a given window. This is the "slowest" average of all three, and as such should have the largest period

When plotted, the Conversion Line (orange by default), Base Line (purple by default), Leading Span A (blue by default), and Leading Span B (red by defaults) are all drawn on the chart along with the price candles. The area between the Leading Span A and Leading Span B lines are also shaded depending on which of the two lines is greater: whenever Leading Span A is greater the area is shaded positively (blue by default), whenever Leading Span B is greater the area is shaded negatively (red by defaults).
One interesting feature of the Ichimoku Cloud is that it drawn a certain number of candles forward. What this means is that where the cloud is drawn on the chart is reflective of prices that have occurred a number of candles in the past. This is done intentionally to help traders see how the current price is moving in relation to historical price movements on the asset.
See below for how the indicators look in their default colors on the chart
snapshot

These indicators can then be used to start analyzing the price movement, and making trade decisions.
The first inference we can make is the momentum of the price. Since the lines are drawn from averages of varying speeds, the shaded area between the Leading Span lines can tell us whether the momentum is bullish (up) or bearish (down).
Whenever Leading Span A, the faster of the two lines, is above Leading Span B, that means that price is moving upward faster than it typically has, ergo we are in Bullish Momentum. On the chart, this is indicated in two ways:
  1. The area is shaded positively (blue by default)
  2. A green upward triangle is added to the chart to indicate where the momentum first turned Bullish

snapshot
Whenever Leading Span A is below Leading Span B, that means that price is moving downward faster than it typically has, ergo we are in Bearish Momentum. On the chart, this is indicated in two ways:
  1. The area is shaded negatively (red by default)
  2. A red downward triangle is added to the chart to indicate where the momentum first turned Bearish

snapshot
The next inference we can make is possible trading points. When we're in a period of momentum, as determined above, we know that price is going up or down, depending on the momentum we're in. We can then use the Conversion Line, Base Line, and the Price itself to confirm a good trade price.
When the asset is in Bullish Momentum, and the Conversion Line, our fastest average, is above the Base Line, our mid speed average, we know that the price is coming up quickly in the short term. When the Base Line and current Price are also above the cloud, then we have triple confirmation that price is going up, and we should enter a Long position. On the chart, this point is indicated with a green flag.
snapshot
When the asset is in Bearish Momentum, and the Conversion Line is below the Base Line, we know that the price is going down quickly in the short term. When the Base Line and current Price are also below the cloud, then we have triple confirmation that price is going down, and we should enter a Short position. On the chart, this point is indicated with a red flag.
snapshot

The script presented here also allows users to customize the various parameters of the Ichimoku Cloud, and visually see how analysis is affected by these changes. This is designed to allow users to modify parameters as they see fit, within certain constraints, to find the best set for them. The lines, cloud, and chart indicators will all update automatically with the users' inputs.
snapshot
Bands and ChannelsCandlestick analysisIchimoku Cloud

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Also on:

Disclaimer