molepy

ORB

Thanks to ChrisMoody for the original script...
Added compatibility with After Hour Market
Added custom period selection
開源腳本

本著真正的TradingView精神,該腳本的作者將其開源發布,以便交易者可以理解和驗證它。為作者喝彩吧!您可以免費使用它,但在出版物中重複使用此代碼受網站規則的約束。 您可以收藏它以在圖表上使用。

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。

想在圖表上使用此腳本?
//Created by user ChrisMoody, with help from Alex in TechSupport and TheLark
//Currently works on Stocks
//Currently works on Forex but only based on the New York Session starting at 1700 East Coast Time
//Futurer Versions will have options to plot sessions bsed on Forex Europe Opening Range , Asia, etc.
// Modified by molepy from here ...
// v1.00 Added Auto Period detection. Excluding Day, Week and Month
// v1.00 Painting Top/Bottom area
// v1.01 Added compatibility with After Hour Market
// v1.02 Change fix period exclusion for parameter selection
// v1.03 Change predefined parameter selection for custom period selection
study(title="ORB", shorttitle="ORB 1.03", overlay=true)

period1 = input(title="Period 1", type=resolution, defval="3")
period2 = input(title="Period 2", type=resolution, defval="15")
period3 = input(title="Period 3", type=resolution, defval="30")
period4 = input(title="Period 4", type=resolution, defval="60")

is_period (ptest) =>
    ptest == period ? 1 : 0

period_flag =
    is_period (period1) +
    is_period (period2) +
    is_period (period3) +
    is_period (period4)

is_newbar(res) => change(time(res)) != 0 

adopt(s) =>
    t = tickerid(syminfo.prefix, ticker, session.regular)
    security(t, period, s, true) 

high_range = valuewhen(is_newbar('D'),high,0)
low_range = valuewhen(is_newbar('D'),low,0)

up = plot(period_flag ? adopt(high_range) : na, color = lime, style=circles, linewidth=4)
down = plot(period_flag ? adopt(low_range) : na, color = #DC143C, style=circles, linewidth=4) 

trans = 75
fill(up, down, color = gray, transp=trans)