Advanced Ichimoku Cloud Settings for Tradingview

 

 

Since I really enjoy using the ichimoku cloud which is also known as the ichimoku Kinko, I thought I might share my more advanced tradingview settings for the ichimoku cloud.

The basic settings which can be found here (Ichimoku Cloud Settings for Tradingview) are definitely enough to get you started.

However, I soon found out that there were too many limitations and not enough customisation options with the basic ichimoku cloud indicator.

 

So without further ado, let’s begin with the crypto ichimoku cloud settings using pine script:

Tradingview Ichimoku Settings with Pinescript

Log in to tradingview with your account

Click on the Pine Editor tab at the bottom of the screen

Copy and paste the following code into your Pine script editor

 

// ICHIMOKU CLOUD V1.0
//


study(title="CM_Enhanced_Ichimoku Cloud-V5.2", shorttitle="CM_Enhanced_Ichimoku-V5.2", overlay=true)
turningPeriods = input(20, minval=1, title="Tenkan-Sen")
standardPeriods = input(60, minval=1, title="Kijun-Sen")
specialAPeriods = input(120, minval=1, title="Kijun-Sen (auxiliary)")

leadingSpan2Periods = input(120, minval=1, title="Senkou Span B")
displacement = input(30, minval=1, title="-ChikouSpan/+SenkouSpan A")
sts = input(true, title="Show Tenkan-Sen")
sks = input(true, title="Show Kijun-Sen")
sksA = input(true, title="Show Kijun-Sen (auxiliary)")
sll = input(true, title="Show Chikou Span (lagging span)?")
sc = input(true, title="Show cloud")
cr1 = input(true, title="Show crossings Tenkan/Kijun")

//Definitions for Tenkan-Sen (20 Period), Kijun-Sen (60 Period), Chikou Span (Lagging Line)
donchian(len) => avg(lowest(len), highest(len))
turning = donchian(turningPeriods)
standard = donchian(standardPeriods)
specialA = donchian(specialAPeriods)
leadingSpan1 = avg(turning, standard)
leadingSpan2 = donchian(leadingSpan2Periods)

//Crosses up/down Tenkan-Sen (20 Period) and Kijun-Sen (60 Period)
crossUpTenkanKinjun = turning[1] < standard[1] and turning >= standard ? 1 : 0
crossDnTenkanKinjun = turning[1] > standard[1] and turning <= standard ? 1 : 0 //First Definition for Ability to Color Cloud based on Trend. leadingSpan1Above = leadingSpan1 >= leadingSpan2 ? 1 : na
leadingSpan2Below = leadingSpan1 <= leadingSpan2 ? 1 : na //Next 4 lines are code used as plots in order to Color Cloud based on Trend span1plotU = leadingSpan1Above ? leadingSpan1 : na span2plotU = leadingSpan1Above ? leadingSpan2 : na span1plotD = leadingSpan2Below ? leadingSpan1 : na span2plotD = leadingSpan2Below ? leadingSpan2 : na col = leadingSpan1 >= leadingSpan2 ? #7D71FC : #E68F8F // bullish, bearish

//Cloud Lines Plot Statements - ***Regular Lines to Fill in Break in Gap
plot(sc and leadingSpan1 ? leadingSpan1 : na, title = 'Senkou Span A cloud', style=line, linewidth=1, offset = displacement, color=col)
plot(sc and leadingSpan2 ? leadingSpan2 : na, title = 'Senkou Span B cloud', style=line, linewidth=3, offset = displacement, color=col)

//Cloud Lines Plot Statements - ***linebr to create rules for change in Shading
p1 = plot(sc and span1plotU ? span1plotU  : na, title = 'Senkou Span A above Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p2 = plot(sc and span2plotU ? span2plotU  : na, title = 'Senkou Span B below Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p3 = plot(sc and span1plotD ? span1plotD  : na, title = 'Senkou Span A below Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p4 = plot(sc and span2plotD ? span2plotD  : na, title = 'Senkou Span B above Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)

//Fills that color cloud based on Trend.
fill(p1, p2, color=#361CCA  ,title='Kumo (Cloud)')    // bullish cloud
fill(p3, p4, color=#CA1C59, title='Kumo (Cloud)')    // bearish cloud

//plots for 3 lines other than cloud.
plot(sts and turning ? turning : na, title = 'Tenkan-Sen', linewidth=2, color=orange, transp=0)
plot(sks and standard ? standard : na, title = 'Kijun-Sen', linewidth=3, color=blue, transp=0)
plot(sksA and specialA ? specialA : na, title = 'Kijun-Sen auxiliary I', linewidth=2, color=black, transp=0)

plot(sll and close ? close : na, title='Chikou Span (Lagging Span)', linewidth=2, offset = -displacement, color=#A900FF)

//Arrow Plots At Tenkan-Sen (20 Period) and Kinjun-Sen (60 Period)
plotchar(cr1 and crossUpTenkanKinjun ? leadingSpan1 : na, title="CrossUp Tenkan Kijun Entry Arrow",char='▲', color=black, transp=0, location=location.absolute, size=size.small)
plotchar(cr1 and crossDnTenkanKinjun ? leadingSpan1 : na, title="CrossUp Tenkan Kijun Entry Arrow",char='▼', color=black, transp=0, location=location.absolute, size=size.small)





As soon as you copied the code, you can save it and then click on Add to Chart.

Your chart should look like this

 

From here, you can customise the clouds colors as you wish.

This is how I like to customise the ichimoku cloud

Below is a reference image of what the different names mean and how the cloud will look like after customising it based on my preferences.

One setting that is pretty useful are the triangles that appear when there is a tiki cross.

A blue triangle means a bullish TK cross

A red triangle means a bearish TK cross

However, I won’t go into too much detail on what they mean in this post. For that you can check out my Beginners ichimoku guide for Crypto.

Hope you enjoyed this post.

 

 

6 Responses

  1. KaBe says:

    Hi,
    Thank you so much for your efforts sharing great tools with deep explanations; I ran your script but had multiple errors. Can you please help ? Here blow is screenshots.

    Processing script…
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`

    • xtarsy says:

      Hi Kabe,
      Thanks for pointing out the error. I updated the script it should work now.
      Have a great day : )

  2. dan says:

    Script has been deleted
    Add to Chart operation failed, reason: line 34: Undeclared identifier `col`;
    line 35: Undeclared identifier `col`;
    line 38: Undeclared identifier `span1plotU`;
    line 38: Undeclared identifier `col`;
    line 39: Undeclared identifier `span2plotU`;
    line 39: Undeclared identifier `col`;
    line 40: Undeclared identifier `span1plotD`;
    line 40: Undeclared identifier `col`;
    line 41: Undeclared identifier `span2plotD`;
    line 41: Undeclared identifier `col`

  3. Woo Joong says:

    I deeply thank you for your explanation, but i also get the error.

    Processing script…
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Script ‘CM_Enhanced_Ichimoku Cloud-V5.2’ has been saved
    Script has been deleted
    Processing script…
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Script ‘CM_Enhanced_Ichimoku Cloud-V5.2’ has been saved
    Add to Chart operation failed, reason: Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Add to Chart operation failed, reason: Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Add to Chart operation failed, reason: Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Processing script…
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`
    Script ‘CM_Enhanced_Ichimoku Cloud-V5.2 1’ has been saved
    Add to Chart operation failed, reason: Error: Undeclared identifier `col`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `span1plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `span2plotU`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `span1plotD`;
    Error: Undeclared identifier `col`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `span2plotD`;
    Error: Undeclared identifier `col`

  4. Lorenzzo Klein says:

    Hello, I’m an ichimoku trader. According to the old ichimoku method I think it would be interesting to make a script that tells you when to long and when to short with its conditions.
    Could you contact me to speak more about it if you have the time ?

  5. Hernan Molina says:

    There is a problem with some comments that extend covering part of the code.
    If you read them then you will see that the definition for the default colors and other patters are in the comment and hence not understood by the script parser as code.
    If you just put the line breaks where they should it will work no problem. In particular the lines:

    crossDnTenkanKinjun = turning[1] > standard[1] and turning = leadingSpan2 ? 1 : na

    must be:

    crossDnTenkanKinjun = turning[1] > standard[1] and turning = leadingSpan2 ? 1 : na

    And the line:

    leadingSpan2Below = leadingSpan1 = leadingSpan2 ? #7D71FC : #E68F8F // bullish, bearish

    must be:

    leadingSpan2Below = leadingSpan1 = leadingSpan2 ? #7D71FC : #E68F8F // bullish, bearish

    Cheers and thank you very much for the explanations 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

12 − 1 =