OPEN-SOURCE SCRIPT

6868

70
//version=5
indicator(title='6868', shorttitle='ICHI', overlay=true)
// Version 1.1
// Created by NgheTrader

TS_D1 = input.int(9, minval=1, title='Tenkan-sen')
KS_D1 = input.int(17, minval=1, title='Kijun-sen')
TS_D2 = input.int(65, minval=1, title='Tenkan-sen')
KS_D2 = input.int(129, minval=1, title='Kijun-sen')
Chikou_Displacement = input.int(25, minval=1, title='Chikou-span')
SB = input.int(26, minval=1, title='Senko Span B')

donchian(len) =>
math.avg(ta.lowest(len), ta.highest(len))

Tenkan = donchian(TS_D1)
Kijun = donchian(KS_D1)
KumoA = math.avg(Tenkan, Kijun)
KumoB = donchian(SB)
DG65 = donchian(TS_D2)
DG129 = donchian(KS_D2)


plot(Tenkan, color=color.new(#0fc7db, 10), title='Tenkan-sen', linewidth=2)
plot(Kijun, color=color.new(#f00f0f, 10), title='Kijun-sen', linewidth=2)
plot(DG65, color=color.new(#f8e804e6, 10), title='dg65', linewidth=2)
plot(DG129, color=color.new(#f99b04, 10), title='DG129', linewidth=2)

plot(close, offset=-Chikou_Displacement, color=color.new(#9c27b0, 10), title='Chikou-span', linewidth=2)

p1 = plot(KumoA, offset=Chikou_Displacement, color=color.new(#0cb71a, 0), linewidth=1, title='Span A')
p2 = plot(KumoB, offset=Chikou_Displacement, color=color.new(#afaaaac5,0), linewidth=1, title='Span B')
fill(p1, p2, color=KumoA > KumoB ? color.new(#106323,80) : color.new(#e4e1e1,0), title='Kumo Cloud')


// Plot Future Lines

Midpoint_future1(len) =>
math.avg(ta.highest(len - 1), ta.lowest(len - 1))
Midpoint_future2(len) =>
math.avg(ta.highest(len - 2), ta.lowest(len - 2))
Midpoint_future3(len) =>
math.avg(ta.highest(len - 3), ta.lowest(len - 3))
Midpoint_future4(len) =>
math.avg(ta.highest(len - 4), ta.lowest(len - 4))
Midpoint_future5(len) =>
math.avg(ta.highest(len - 5), ta.lowest(len - 5))
Midpoint_future6(len) =>
math.avg(ta.highest(len - 6), ta.lowest(len - 6))
Midpoint_future7(len) =>
math.avg(ta.highest(len - 7), ta.lowest(len - 7))
Midpoint_future8(len) =>
math.avg(ta.highest(len - 8), ta.lowest(len - 8))
Midpoint_future9(len) =>
math.avg(ta.highest(len - 9), ta.lowest(len - 9))
Midpoint_future10(len) =>
math.avg(ta.highest(len - 10), ta.lowest(len - 10))
Midpoint_future11(len) =>
math.avg(ta.highest(len - 11), ta.lowest(len - 11))
Midpoint_future12(len) =>
math.avg(ta.highest(len - 12), ta.lowest(len - 12))
Midpoint_future13(len) =>
math.avg(ta.highest(len - 13), ta.lowest(len - 13))
Midpoint_future14(len) =>
math.avg(ta.highest(len - 14), ta.lowest(len - 14))

// Plot Future Daily Kijun

KJ_Next_1 = Midpoint_future1(KS_D1)
KJ_Next_2 = Midpoint_future2(KS_D1)
KJ_Next_3 = Midpoint_future3(KS_D1)
KJ_Next_4 = Midpoint_future4(KS_D1)
KJ_Next_5 = Midpoint_future5(KS_D1)
KJ_Next_6 = Midpoint_future6(KS_D1)
KJ_Next_7 = Midpoint_future7(KS_D1)
KJ_Next_8 = Midpoint_future8(KS_D1)
KJ_Next_9 = Midpoint_future9(KS_D1)
KJ_Next_10 = Midpoint_future10(KS_D1)

plot(KJ_Next_1, color=color.new(#f00f0f, 10), linewidth=1, offset=1, show_last=1, style=plot.style_circles)
plot(KJ_Next_2, color=color.new(#f00f0f, 10), linewidth=1, offset=2, show_last=1, style=plot.style_circles)
plot(KJ_Next_3, color=color.new(#f00f0f, 10), linewidth=1, offset=3, show_last=1, style=plot.style_circles)
plot(KJ_Next_4, color=color.new(#f00f0f, 10), linewidth=1, offset=4, show_last=1, style=plot.style_circles)
plot(KJ_Next_5, color=color.new(#f00f0f, 10), linewidth=1, offset=5, show_last=1, style=plot.style_circles)
plot(KJ_Next_6, color=color.new(#f00f0f, 10), linewidth=1, offset=6, show_last=1, style=plot.style_circles)
plot(KJ_Next_7, color=color.new(#f00f0f, 10), linewidth=1, offset=7, show_last=1, style=plot.style_circles)
plot(KJ_Next_8, color=color.new(#f00f0f, 10), linewidth=1, offset=8, show_last=1, style=plot.style_circles)
plot(KJ_Next_9, color=color.new(#f00f0f, 10), linewidth=1, offset=9, show_last=1, style=plot.style_circles)
plot(KJ_Next_10,color=color.new(#f00f0f, 10), linewidth=1, offset=10, show_last=1, style=plot.style_circles)


// Plot Future Daily Tenkan

TS_Next_1 = Midpoint_future1(TS_D1)
TS_Next_2 = Midpoint_future2(TS_D1)
TS_Next_3 = Midpoint_future3(TS_D1)
TS_Next_4 = Midpoint_future4(TS_D1)
TS_Next_5 = Midpoint_future5(TS_D1)
TS_Next_6 = Midpoint_future6(TS_D1)
TS_Next_7 = Midpoint_future7(TS_D1)
TS_Next_8 = Midpoint_future8(TS_D1)


plot(TS_Next_1, color=color.new(#0fc7db, 10), linewidth=1, offset=1, show_last=1, style=plot.style_circles)
plot(TS_Next_2, color=color.new(#0fc7db, 10), linewidth=1, offset=2, show_last=1, style=plot.style_circles)
plot(TS_Next_3, color=color.new(#0fc7db, 10), linewidth=1, offset=3, show_last=1, style=plot.style_circles)
plot(TS_Next_4, color=color.new(#0fc7db, 10), linewidth=1, offset=4, show_last=1, style=plot.style_circles)
plot(TS_Next_5, color=color.new(#0fc7db, 10), linewidth=1, offset=5, show_last=1, style=plot.style_circles)
plot(TS_Next_6, color=color.new(#0fc7db, 10), linewidth=1, offset=6, show_last=1, style=plot.style_circles)
plot(TS_Next_7, color=color.new(#0fc7db, 10), linewidth=1, offset=7, show_last=1, style=plot.style_circles)
plot(TS_Next_8, color=color.new(#0fc7db, 10), linewidth=1, offset=8, show_last=1, style=plot.style_circles)

// Plot Future Kumo A

Next_KumoA_1 = Midpoint_future1(TS_D2)
Next_KumoA_2 = Midpoint_future2(TS_D2)
Next_KumoA_3 = Midpoint_future3(TS_D2)
Next_KumoA_4 = Midpoint_future4(TS_D2)
Next_KumoA_5 = Midpoint_future5(TS_D2)
Next_KumoA_6 = Midpoint_future6(TS_D2)
Next_KumoA_7 = Midpoint_future7(TS_D2)
Next_KumoA_8 = Midpoint_future8(TS_D2)
Next_KumoA_9 = Midpoint_future9(TS_D2)


plot(Next_KumoA_1, color=color.new(#f8e804e6, 10), linewidth=1, offset=1, show_last=1, style=plot.style_circles)
plot(Next_KumoA_2, color=color.new(#f8e804e6, 10), linewidth=1, offset=2, show_last=1, style=plot.style_circles)
plot(Next_KumoA_3, color=color.new(#f8e804e6, 10), linewidth=1, offset=3, show_last=1, style=plot.style_circles)
plot(Next_KumoA_4, color=color.new(#f8e804e6, 10), linewidth=1, offset=4, show_last=1, style=plot.style_circles)
plot(Next_KumoA_5, color=color.new(#f8e804e6, 10), linewidth=1, offset=5, show_last=1, style=plot.style_circles)
plot(Next_KumoA_6, color=color.new(#f8e804e6, 10), linewidth=1, offset=6, show_last=1, style=plot.style_circles)
plot(Next_KumoA_7, color=color.new(#f8e804e6, 10), linewidth=1, offset=7, show_last=1, style=plot.style_circles)
plot(Next_KumoA_8, color=color.new(#f8e804e6, 10), linewidth=1, offset=8, show_last=1, style=plot.style_circles)
plot(Next_KumoA_9, color=color.new(#f8e804e6, 10), linewidth=1, offset=9, show_last=1, style=plot.style_circles)
// Plot Future Kumo B

KB_Next_1 = Midpoint_future1(KS_D2)
KB_Next_2 = Midpoint_future2(KS_D2)
KB_Next_3 = Midpoint_future3(KS_D2)
KB_Next_4 = Midpoint_future4(KS_D2)
KB_Next_5 = Midpoint_future5(KS_D2)
KB_Next_6 = Midpoint_future6(KS_D2)
KB_Next_7 = Midpoint_future7(KS_D2)
KB_Next_8 = Midpoint_future8(KS_D2)
KB_Next_9 = Midpoint_future9(KS_D2)
KB_Next_10 = Midpoint_future10(KS_D2)
KB_Next_11 = Midpoint_future11(KS_D2)
KB_Next_12 = Midpoint_future12(KS_D2)
KB_Next_13 = Midpoint_future13(KS_D2)
KB_Next_14 = Midpoint_future14(KS_D2)


plot(KB_Next_1, color=color.rgb(253, 173, 0), linewidth=1, offset=1, show_last=1, style=plot.style_circles)
plot(KB_Next_2, color=color.rgb(253, 173, 0), linewidth=1, offset=2, show_last=1, style=plot.style_circles)
plot(KB_Next_3, color=color.rgb(253, 173, 0), linewidth=1, offset=3, show_last=1, style=plot.style_circles)
plot(KB_Next_4, color=color.rgb(253, 173, 0), linewidth=1, offset=4, show_last=1, style=plot.style_circles)
plot(KB_Next_5, color=color.rgb(253, 173, 0), linewidth=1, offset=5, show_last=1, style=plot.style_circles)
plot(KB_Next_6, color=color.rgb(253, 173, 0), linewidth=1, offset=6, show_last=1, style=plot.style_circles)
plot(KB_Next_7, color=color.rgb(253, 173, 0), linewidth=1, offset=7, show_last=1, style=plot.style_circles)
plot(KB_Next_8, color=color.rgb(253, 173, 0), linewidth=1, offset=8, show_last=1, style=plot.style_circles)
plot(KB_Next_9, color=color.rgb(253, 173, 0), linewidth=1, offset=9, show_last=1, style=plot.style_circles)
plot(KB_Next_10, color=color.rgb(253, 173, 0), linewidth=1, offset=10, show_last=1, style=plot.style_circles)
plot(KB_Next_11, color=color.rgb(253, 173, 0), linewidth=1, offset=11, show_last=1, style=plot.style_circles)
plot(KB_Next_12, color=color.rgb(253, 173, 0), linewidth=1, offset=12, show_last=1, style=plot.style_circles)
plot(KB_Next_13, color=color.rgb(253, 173, 0), linewidth=1, offset=13, show_last=1, style=plot.style_circles)
plot(KB_Next_14, color=color.rgb(253, 173, 0), linewidth=1, offset=14, show_last=1, style=plot.style_circles)

var line greenLine = na
var line redLine = na

xGreen = bar_index - 8
xRed = bar_index - 16

// Dùng khoảng 100 nến gần nhất để lấy phạm vi giá hiện hành
lookback = 100
top = ta.highest(high, lookback)
bottom = ta.lowest(low, lookback)

if bar_index > 17
line.delete(greenLine)
line.delete(redLine)

greenLine := line.new( x1 = xGreen, y1 = top, x2 = xGreen, y2 = bottom, color=color.new(#0fc7db, 85), width = 4)

redLine := line.new( x1 = xRed, y1 = top, x2 = xRed, y2 = bottom,color =color.new(#f00f0f, 85), width = 4 )

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.