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)