albert.callisto

CM_Enhanced_Ichimoku Cloud-V5.1

Based upon Thanks Chris Moody !

Here are my changes, I looked at comments on the original page.

  • Thinner default lines, changed colors
  • Added options to add two extra Kijun with their own periods, useful to check resistance/support lines on different scales
  • Decreased height of arrows

开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?
// Created By User ChrisMoody (CM)
// Tweaked by Albert Callisto (AC)
// Last Update 31 Jan 2016
// Version 5.1
// (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.1", shorttitle="CM_Enhanced_Ichimoku-V5.1", overlay=true)
turningPeriods = input(9, minval=1, title="Tenkan-Sen")
standardPeriods = input(26, minval=1, title="Kinjun-Sen")
specialAPeriods = input(52, minval=1, title="Kinjun-Sen auxiliary")
specialBPeriods = input(104, minval=1, title="Kinjun-Sen auxiliary II")

leadingSpan2Periods = input(52, minval=1, title="Senkou Span B")
displacement = input(26, minval=1, title="-ChinkouSpan/+SenkouSpan A")
sts = input(true, title="Show Tenkan-Sen (9 Period)?")
sks = input(true, title="Show Kinjun-Sen (26 Period)?")
sksA = input(true, title="Show Kinjun-Sen auxiliary")
sksB = input(true, title="Show Kinjun-Sen auxiliary II")
sll = input(true, title="Show Chinkou Span (Lagging Line)?")
sc = input(true, title="Show Cloud?")
cr1 = input(true, title="Show Crosses up/down Tenkan-Sen (9 Period) and Kinjun-Sen (26 Period?")

//Definitions for Tenkan-Sen (9 Period), Kinjun-Sen (26 Period), Chinkou Span (Lagging Line)
donchian(len) => avg(lowest(len), highest(len))
turning = donchian(turningPeriods)
standard = donchian(standardPeriods)
specialA = donchian(specialAPeriods)
specialB = donchian(specialBPeriods)
leadingSpan1 = avg(turning, standard)
leadingSpan2 = donchian(leadingSpan2Periods)

//Crosses up/down Tenkan-Sen (9 Period) and Kinjun-Sen (26 Period)
crossUpTenkanKinjun = turning[1] < standard[1] and turning > standard ? 1 : 0
crossDnTenkanKinjun = turning[1] > standard[1] and turning < standard ? 1 : 0
cupA = crossUpTenkanKinjun == 1 ? crossUpTenkanKinjun : 0
cdnB = crossDnTenkanKinjun == 1 ? crossDnTenkanKinjun : 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 ? #225437 : #5B1A13 // bullish, bearish

//plots for 3 lines other than cloud.
plot(sts and turning ? turning : na, title = 'Tenkan-Sen (9 Period)', linewidth=1, color=orange)
plot(sks and standard ? standard : na, title = 'Kinjun-Sen (26 Period)', linewidth=2, color=green)
plot(sksA and specialA ? specialA : na, title = 'Kinjun-Sen auxiliary I', linewidth=2, color=gray)
plot(sksB and specialB ? specialB : na, title = 'Kinjun-Sen auxiliary II', linewidth=2, color=black)

plot(sll and close ? close : na, title='Chinkou Span (Lagging Line)', linewidth=1, offset = -displacement, color=blue)

//Cloud Lines Plot Statements - ***Regular Lines to Fill in Break in Gap
plot(sc and leadingSpan1 ? leadingSpan1 : na, title = 'Senkou Span A (26 Period) Cloud', style=line, linewidth=1, offset = displacement, color=col)
plot(sc and leadingSpan2 ? leadingSpan2 : na, title = 'Senkou Span B (52 Period) 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 (26 Period) Above Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p2 = plot(sc and span2plotU ? span2plotU  : na, title = 'Senkou Span B (52 Period) Below Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p3 = plot(sc and span1plotD ? span1plotD  : na, title = 'Senkou Span A (26 Period) Below Span B Cloud', style=linebr, linewidth=1, offset = displacement, color=col)
p4 = plot(sc and span2plotD ? span2plotD  : na, title = 'Senkou Span B (52 Period) Above Span A Cloud', style=linebr, linewidth=1, offset = displacement, color=col)

//Fills that color cloud based on Trend.
fill(p1, p2, color=#6BA583 , transp=70, title='Kumo (Cloud)')    // bullish cloud
fill(p3, p4, color=#D75442, transp=70, title='Kumo (Cloud)')    // bearish cloud

//Arrow Plots At Tenkan-Sen (9 Period) and Kinjun-Sen (26 Period)
plotarrow(cr1 and cupA ? cupA : na, title="CrossUp Tenkan Kinjun Entry Arrow", colorup=black, maxheight=20, minheight=20, transp=0)
plotarrow(cr1 and cdnB*-1 ? cdnB*-1 : na, title="CrossDn Tenkan Kinjun Entry Arrow", colordown=black, maxheight=20, minheight=20, transp=0)