BrainZZ

Ichimoku PanOptic TM-V5 by BrainZZ

126
Update of the previous script.

New functions added:
- Highlight of price crossing KS
- Highlight of TS/KS crossing
- Highlight of rising/falling periods of KS
- Critical levels for SSB, KS and TS/
オープンソーススクリプト

TradingViewの精神に則り、このスクリプトの作者は、トレーダーが理解し検証できるようにオープンソースで公開しています。作者に敬意を表します!無料で使用することができますが、このコードを投稿で再利用するには、ハウスルールに準拠する必要があります。 お気に入りに登録してチャート上でご利用頂けます。

免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。

チャートでこのスクリプトを利用したいですか?
//Created By User BrainZZ on the work of User ChrisMoody
//Last Update 17/06/2016
//new Updates include signal based on PanOptical Method by User Ichimoku_Trader

study(title="Ichimoku PanOptic TM-V1", shorttitle="PTM_Ichimoku-V1", overlay=true)
turningPeriods = input(9, minval=1, title="Tenkan-Sen")
standardPeriods = input(26, minval=1, title="Kinjun-Sen")
leadingSpan2Periods = input(52, minval=1, title="Senkou SpanB")
displacement = input(26, minval=1, title="ChinkouSpan/ SenkouSpanA")
//sts = input(true, title="Show TS (Tenkan-Sen)?")
//sks = input(true, title="Show KS (Kinjun-Sen)?")
//sll = input(true, title="Show CS (ChinkouSpan)?")
//sc = input(true, title="Show Kumo Cloud?")
sts=true
sks=true
sll=true
sc=true
cr0 = input(false, title="Show price/KS crossing?")
cr1 = input(false, title="Show TS/KS crossing?")
cr2 = input(false, title="Show KS turning Up/Down?")
cr3 = input(false, title="Show critical levels?")

//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)
leadingSpan1 = avg(turning, standard)
leadingSpan2 = donchian(leadingSpan2Periods)

//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 ? green : red

//plots for 3 lines other than cloud.
plot(sts and turning ? turning : na, title = 'Tenkan-Sen (9 Period)', linewidth=3, transp=0, color= #ff6600)
plot(sks and standard ? standard : na, title = 'Kinjun-Sen (26 Period)', linewidth=3, transp=0, color=#ff0000)
plot(sll and close ? close : na, title='Chinkou Span (Lagging Line)', linewidth=1, offset =-displacement, transp=0, color= #0066ff)

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

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

//Fills that color cloud based on Trend.
fill(p1, p2, color=green, transp=70, title='Kumo (Cloud)')
fill(p3, p4, color=red, transp=70, title='Kumo (Cloud)')

//Crosses up/down Tenkan-Sen (9 Period) and Kinjun-Sen (26 Period) = Arrow plots at TS KS cross
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
plotshape(cr1 and cupA ? cupA : na, title="CrossUp TS/KS Entry Arrow", style=shape.triangleup,location=location.belowbar, color=green, transp=0, size=size.small)
plotshape(cr1 and cdnB*-1 ? cdnB*-1 : na, title="CrossDn TS/KS Entry Arrow", style=shape.triangledown,location=location.abovebar, color=red, transp=0, size=size.small)

//Spot price reversal = Arrow plots at price crossing KS
crossUpKS = standard <= close and close[1] <= standard[1] ? 1 : 0
crossDnKS = standard >= close and close[1] >= standard[1] ? 1 : 0
cup = crossUpKS == 1 ? crossUpKS : 0
cdn = crossDnKS == 1 ? crossDnKS : 0
plotshape(cr0 and cup ? cup : na, title="CrossUp KS Entry Arrow", style=shape.triangleup,location=location.belowbar, color=green, transp=0, size=size.tiny)
plotshape(cr0 and cdn*-1 ? cdn*-1 : na, title="CrossDn TS Entry Arrow", style=shape.triangledown,location=location.abovebar, color=red, transp=0, size=size.tiny)

//Changing in KS as trend signal = Arrow plots on KS turn
KSturnup = rising(standard,1)==1 ? 1 : 0
KSturndown = falling(standard,1)==1 ? -1 : 0
KupA = KSturnup == 1 ? 1 : KSturndown==0 and barssince(KSturnup==1)<26 and turning>standard ? 1 : 0
KdnB = KSturndown == -1 ? -1 : KSturnup==0 and barssince(KSturndown==-1)<26 and turning<standard ? -1 : 0
plotshape(cr2 and KupA ? KupA : na, title="KS Up Arrow", style=shape.triangleup,location=location.bottom, color=green, transp=0, size=size.tiny)
plotshape(cr2 and KdnB ? KdnB : na, title="KS Down Arrow", style=shape.triangledown,location=location.top, color=red, transp=0, size=size.tiny)

//Critical levels based on previous Highs and Lows
Mhigh = security(tickerid, 'M', high) 
MpH = pivothigh(Mhigh,0,0)
Mlow = security(tickerid, 'M', low)
Whigh = security(tickerid, 'W', high) 
Wlow = security(tickerid, 'W', low)
Dhigh = security(tickerid, 'D', high) 
Dlow = security(tickerid, 'D', low)
//plot(Mhigh, title="M_High",style=circles, color=black, linewidth=2) 
//plot(Mlow, title="M_Low",style=circles, color=black, linewidth=2) 
//plot(Whigh, title="M_High",style=circles, color=black, linewidth=2) 
//plot(Wlow, title="M_Low",style=circles, color=black, linewidth=2) 
//plot(Dhigh, title="M_High",style=circles, color=black, linewidth=2) 
//plot(Dlow, title="M_Low",style=circles, color=black, linewidth=2) 

uSSBdev=dev(highest(52),52)?na:highest(52)
upSSB=fixnan(uSSBdev)
lSSBdev=dev(lowest(52),52)?na:lowest(52)
lowSSB=fixnan(lSSBdev)

uKSdev=dev(highest(26),26)?na:highest(26)
upKS=fixnan(uKSdev)
lKSdev=dev(lowest(26),26)?na:lowest(26)
lowKS=fixnan(lKSdev)

uTSdev = dev(highest(9),9)?na:highest(9)
upTS = fixnan(uTSdev)
lTSdev = dev(lowest(9),9)?na:lowest(9)
lowTS = fixnan(lTSdev)

plot(cr3 and upSSB?upSSB:na,style=circles,color=black,linewidth=2,offset=-52)
plot(cr3 and lowSSB?lowSSB:na,style=circles,color=black,linewidth=2,offset=-52)
plot(cr3 and upKS?upKS:na,style=circles,color=red,linewidth=2,offset=-26)
plot(cr3 and lowKS?lowKS:na,style=circles,color=red,linewidth=2,offset=-26)
plot(cr3 and upTS?upTS:na,style=circles,color=orange,linewidth=2,offset=-9)
plot(cr3 and lowTS?lowTS:na,style=circles,color=orange,linewidth=2,offset=-9)