albert.callisto

CM_Enhanced_Ichimoku Cloud-V5.2

New version of the improved Ichimoku cloud

Original by Chris Moody, great work.

This indicator is a colorized Ichimoku with colors that you can change for any component. Not many changes between 5.1 and 5.2, I fixed some labels and the crossing detection, as well as the default colors.
There's not much more left we can do without radically changing the original Ichimoku. We could implement full-multiframe but you can already do that by adding several times this indicator and changing the periods.

Displayed components:
  • Kijun-Sen: middle of the highest/lowest prices during the last 26 periods
  • Tenkan-Sen: middle of the highest/lowest prices during the last 9 periods
  • Senkou Span A (SSA) : average of Kijun and Tenkan, projected 26 periods ahead
  • Senkou Span B (SSB): middle of the highest/lowest prices during the last 52 periods, and projected 26 periods ahead
  • Chikou Span: the closing price projected 26 periods behind.
  • Kumo: the cloud itself, the area between SSA/SSB.

The script also provides indication of the crossings between Tenkan and Kijun, some trading strategies are based upon that. There is also a separate Kijun with its own period for those you'd like to have this information at another timeframe. I removed the third Kijun that was in version 5.1, I don't think it was widely used and made the configuration screen too crowded. If you really need this, take a look at Donchian indicators, the Kijun is basically a Donchian on 26 periods.

Chris Moody Version (v5):

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 a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
// ENHANCED ICHIMOKU CLOUD V5.2
//
// Created By User ChrisMoody (CM)
// Tweaked by Albert Callisto (AC)
// Last Update 12 Jun 2016
// Version 5.2
// (AC - 5.2) Changed colors, fixed labels, fixed transparency. 
//            Removed the auxiliary II to speed up performance.
//            Fixed crossing detection (due to technical constraints, I can't still put them at the exact crossing location.)
// (AC - 5.1) Thinner default lines, changed colors
// (AC - 5.1) Added options to add two extra Kijun with their own periods, useful to check support.
// (AC - 5.1) Decreased height of arrows

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

leadingSpan2Periods = input(52, minval=1, title="Senkou Span B")
displacement = input(26, 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 (9 Period), Kijun-Sen (26 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 (9 Period) and Kijun-Sen (26 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 (9 Period) and Kinjun-Sen (26 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)