ORB

zzzcrypto123 · study · 49 行 · 点赞 11,690 · TradingView 原页

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

Pine Script

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © dzedvon91
 
//@version=4
study("ORB", overlay = true)
 
 
inputMax = input(5, title= "ORB total time (minutes)")
hide = timeframe.isintraday and timeframe.multiplier <= inputMax
 
show_daily_range = true
 
sessSpec = input("0915-0920:1234567", type=input.session, title="Session Time")  
t = time(timeframe.period, sessSpec)
 
is_newbar(res) => change(time(res)) != 0
 
in_session = not na(t)
is_first = in_session and not in_session[1]
was_last = not in_session and in_session[1]
 
orb_high = float(na)
orb_low = float(na)
 
 
 
if is_first
    orb_high := high
    orb_low := low
 
else
    orb_high := orb_high[1]
    orb_low := orb_low[1]
 
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 not show_daily_range
    orb_high := na
    orb_low := na
   
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)

← 返回列表