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)