本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © john_everist
//@version=4
study("Show Daily Candles", overlay = true)
num_of_bars_in_day()=>
day_bar = security(syminfo.tickerid, "D", open)
count = 1
for i = 1 to 1440
if day_bar[1] != day_bar[count]
break
count := count+1
bars_in_day = 0
for a = 1 to 999
if count == count[a]
break
bars_in_day := bars_in_day+1
bars_in_day:=bars_in_day+1
bars_in_day:=timeframe.isintraday and timeframe.period == "1"?1440:bars_in_day
bars_in_day = num_of_bars_in_day()
o = security(syminfo.tickerid, "D", open)
h = security(syminfo.tickerid, "D", high)
l = security(syminfo.tickerid, "D", low)
c = security(syminfo.tickerid, "D", close)
col = c>o?color.green:color.red
col := o[1]!=o?na:col
op = plot(o, style=plot.style_linebr, color = col, transp = 100, offset = -bars_in_day)
cl = plot(c, style=plot.style_linebr, color = col, transp = 100, offset = -bars_in_day)
fill(op,cl, color = col, transp = 55)
hi = plot(h, style=plot.style_linebr, color = col, transp = 100, offset = -bars_in_day)
lo = plot(l, style=plot.style_linebr, color = col, transp = 100, offset = -bars_in_day)
fill(hi,lo, color = col, transp =80)