vdubus

Vdub_Tetris_V2

509
**Update**
Colour background Buy & Sell Signal

Original - Vdub-Tetris-V0/

开源脚本

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

免责声明

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

想在图表上使用此脚本?
study("Vdub_Tetris_V2", overlay=true)
Sml_Channel_TF_mins_D_W_M = input("240")
Range = input(1)

SELL = security(tickerid, Sml_Channel_TF_mins_D_W_M, highest(Range))
BUY = security(tickerid, Sml_Channel_TF_mins_D_W_M, lowest(Range))

HI = plot(SELL, color=SELL!=SELL[1]?na:red,linewidth=2 )
LO = plot(BUY, color=BUY!=BUY[1]?na:green,linewidth=2 )
fill(HI, LO, color=#E3CAF1, transp=80)
Hcon = high >= SELL
Lcon = low <= BUY

plotshape(Hcon, style=shape.triangledown, color=maroon, location=location.abovebar, text='SELL')
plotshape(Lcon, style=shape.triangleup, color=green, location=location.belowbar, text='BUY')
range = SELL-BUY
//--------------------------------------------------
Lrg_Channel_TF_mins_D_W_M = input('D')
M_HIGH = security(tickerid, Lrg_Channel_TF_mins_D_W_M, high)
M_LOW = security(tickerid, Lrg_Channel_TF_mins_D_W_M, low)
plot(M_HIGH, color=M_HIGH != M_HIGH[1] ?na:fuchsia, style=line, linewidth=2)
plot(M_LOW, color=M_LOW != M_LOW[1] ?na:fuchsia, style=line, linewidth=2)
//--------------------------------------------------
length = input(4)
hls = rma(hl2, length)
isRising = hls >= hls[1]

zigzag1 = isRising and not isRising[1] ? lowest(length) :  not isRising and isRising[1] ? highest(length) : na
plot(zigzag1, color=black)

Zigzag2 = input(false)
zigzag = Hcon ? high : Lcon ? low : na
plot(not Zigzag2 ? na : zigzag, color=red, style=line, linewidth=3)

//========================bgcolor=================================
bgcolor(Hcon >= Lcon ? #FFFFFF : #0000FF, transp=90)
bgcolor(Lcon >= Hcon ? #FFFFFF : #9771C5, transp=80)
//--------------------------