Michigandolf's 30min Opening Range

Michigandolf · study · 34 行 · 点赞 1,746 · TradingView 原页

本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。

Pine Script

study(title="Michigandolf's 30min Opening Range", shorttitle="Michigandolf's 30min OR", overlay=true)
High30 = input(true, title="OR High")
Low30 = input(true, title="OR Low")
Mid30 = input(true, title="OR Mid")
PDHI = input(true, title="Previous Day High")
PDLO = input(true, title="Previous Day Low")
 
NewBar(res) => change(time(res)) != 0
 
adopt(r, s) => security(tickerid, r, s) 
 
//Previous Day's Highs and Lows
PDH = security(tickerid, 'D', high[1]) 
PDL = security(tickerid, 'D', low[1]) 
PDC =  security(tickerid, 'D', close[1]) 
PDO =  security(tickerid, 'D', open[1]) 
 
//Previous Day's Highs and Lows PLots
plot(isintraday and PDHI ? PDH : na, title="PDHI",style=line, color= #1BE091,linewidth=1) 
plot(isintraday and PDLO ? PDL : na, title="PDLO",style=line, color= #E02B16,linewidth=1)
 
//Opening Range Calculation
ORHigh = valuewhen(NewBar('D'),high,0) 
ORLow = valuewhen(NewBar('D'),low,0) 
ORMid = ((ORHigh - ORLow) / 2) + ORLow
 
//Opening Range Plots
H30P = plot(High30 ? adopt('30', ORHigh): na, color = #268FFF, style=line, linewidth=2) 
L30P = plot(Low30 ? adopt('30', ORLow): na, color = #FF217E, style=line, linewidth=2)
M30P = plot(Mid30 ? adopt('30', ORMid): na, color = #FFFFFF, style=line, linewidth=1) 
 
//Opening Range Background Shading
FillColor = High30 ?  97 : 100
fill(H30P, L30P, color = white, transp=FillColor)

← 返回列表