ORB 5:6

POWER_TRADES · study · 50 行 · 点赞 724 · TradingView 原页

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

Pine Script

//@version=5
indicator('ORB 5:6', overlay=true)
 
inputMax = input(5, title='ORB total time (minutes)')
sess = input.session('0915-0920', title='Session Time')
t = time(timeframe.period, sess + ':1234567')
hide = timeframe.isintraday and timeframe.multiplier <= inputMax
 
is_newbar(res) =>
    ta.change(time(res)) != 0
in_session = not na(t)
is_first = in_session and not in_session[1]
 
orb_high = float(na)
orb_low = float(na)
orb_open = float(na)
orb_close = float(na)
if is_first
    orb_high := high
    orb_low := low
    orb_open := open
    orb_close := close
    orb_close
else
    orb_high := orb_high[1]
    orb_low := orb_low[1]
    orb_open := orb_open[1]
    orb_close := orb_close[1]
    orb_close
if high > orb_high and in_session
    orb_high := high
    orb_high
if low < orb_low and in_session
    orb_low := low
    orb_low
if close < orb_close and in_session
    orb_close := close
    orb_close
if open < orb_open and in_session
    orb_open := open
    orb_open
gh = (orb_high + orb_low) / 2
fs = gh - 0.00118 * gh
fs1 = gh + 0.00118 * gh
hh = orb_close > orb_open ? fs : fs1
//plot(hide ? orb_high : na , style=plot.style_line, color=orb_high[1] != orb_high ? na : color.green, title="ORB High", linewidth=2)
//plot(hide ? orb_low : na , style=plot.style_line, color=orb_low[1] != orb_low ? na : color.red, title="ORB Low", linewidth=2)
plot(gh, style=plot.style_line, color=gh[1] != gh ? na : color.black, title='50change', linewidth=2)
 
plot(hh, style=plot.style_line, color=hh[1] != hh ? na : color.black, title='gold Low', linewidth=2)

← 返回列表