ChrisMoody

Opening Range Breakout with 2 Profit Targets.

Opening Range Breakout with 2 Profit Targets.

Updated Indicator now works on all Symbols with Many Different Session Options.

***Known PineScript Issue…While the Opening Range is being Formed the lines only adjust for that individual bar. Just reset Indicator after Opening Range Completes.

***All Times are Based on New York Time
Session Options Forex U.S. Banks Open (8:00), Gold U.S. Open (8:20), Oil U.S. Open (9:00), U.S. Cash Session - Stocks (9:30), NY Forex Open (17:00) , Europe Open (02:00), or if you choose Setting 0 the Session Runs from 00:00 to 00:00 (Midnight to Midnight).

***Ability to use 60 minute Opening Range, 30 minute, 15 minute, and many other options.

***However you can manually change the times in the Inputs Tab to adjust for any session you prefer. This is useful for Day Light Savings Adjustments. Also the default times work if your charts are set to EST Time. If you use A different time zone in your settings you need to Adjust the times in the inputs tab.

Initially Opening Range High and Low plot as Yellow Lines. If Price Goes Above Opening Range then Line Turns Green. If Price Goes Below Opening Range Line Turns Red.

By default the First Profit Target is 1/2 the Width of the Opening Range and the 2nd Profit Target is 1 Times the Opening Range. However these are Adjustable in the Inputs Tab.

By Default the Opening Range Length is 1 Hour. However, you can Change the Opening Range Length to 15 min, 30 min, 2 hours etc. in the Inputs Tab.

Plots a 1 Above or Below Candle when 1st Profit Target is Achieved, and a 2 when 2nd Profit Target is Achieved.
오픈 소스 스크립트

진정한 TradingView의 정신에 따라, 이 스크립트의 작성자는 스크립트를 오픈소스로 게시했기에 거래자들이 이해하고 확인할 수 있습니다. 작가님께 건배! 스크립트를 무료로 사용할 수 있지만, 게시물에서 이 코드를 재사용하는 것은 하우스룰을 따릅니다. 당신은 스크립트를 차트에 사용하기 위해 그것을 즐겨찾기 할 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?
//Created by ChrisMoody on 7-07-2014, Special Thanks To "The Coding Genius Behind The Curtain"
study(title="_CM_Opening-Range-Final", shorttitle="_CM_OpenRange_PlusTargets", overlay=true)

sessNum = input(4, title="Session to use (0 = 24 Hours, Other Numbers Listed Below)", minval=0, maxval=6)
desc = input(false, title="Below---Line Plot Start Times and End Times---Change Input Above To Select")
forex_US_BankingOpen = input('0800-1700', type=session, title="1 - Forex U.S. Banks Open -- ALL START TIMES = START OF OPENING RANGE!!!")
gold_US_Open = input('0820-1700', type=session, title="2 - Gold U.S. Open -- All End Times are when Lines Stop Plotting")
oil_US_Open = input('0900-1700', type=session, title="3 - Oil U.S. Open")
usStocksOpen = input('0930-1600', type=session, title="4 - U.S. Cash Cash Session - Stocks Session")
nyForexOpen = input('1700-1600', type=session, title="5 - NY Forex Open")
europeOpen = input('0200-1700', type=session, title="6 - Europe")
pt1 = input(5, minval=1, maxval=15, title="Profit Target 1 - Multiple of Opening Range *.1, 5 = .5, 7 = .7, 10 = 1, 15 = 1.5 etc.")
pt2 = input(10, minval=1, maxval=30, title="Profit Target 2 - Multiple of Opening Range *.1, 10 = 1, 15 = 1.5, 18 = 1.8, etc.")
res = input('60', type=resolution, title="Length Of Opening Range?")
snp = input(true, title="Plot 1 and 2 When 1st and 2nd Profit Target are Achieved?")

//Session Selection Rules
sessToUse = sessNum == 1 ? forex_US_BankingOpen : sessNum == 2 ? gold_US_Open : sessNum == 3 ? oil_US_Open : sessNum == 4 ? usStocksOpen : sessNum == 5 ? nyForexOpen : sessNum == 6 ? europeOpen :'0000-0000'

//Session Rules
bartimeSess = (sessNum == 0 ? time('D') : time('D', sessToUse))
fr2to17 = (sessNum == 0 ? time(period) : time(period, sessToUse)) 
newbarSess = bartimeSess != bartimeSess[1]
high_range = valuewhen(newbarSess,high,0)
low_range = valuewhen(newbarSess,low,0)
adopt(r, s) => security(tickerid, r, s)

//Formula For Opening Range
highRes = adopt(res, high_range)
lowRes = adopt(res, low_range)
range = highRes - lowRes

//Highlighting Line Rules For Opening Range
highColor = high > highRes ? lime : yellow
lowColor = low < lowRes ? red : yellow

//Plot Statements For Opening Range Lines
openRangeHigh = plot(fr2to17 > 0 ? highRes : na, color=highColor, style=circles, linewidth=4)
openRangeLow = plot(fr2to17 > 0 ? lowRes : na, color=lowColor, style=circles, linewidth=4)
bgcolor(fr2to17 > 0 ? silver : na, transp=85)
fill(openRangeHigh, openRangeLow, color=silver, transp=70, title="Opening Range Fill")

//Formula For Profit Target 1
pft1 = pt1*.1
highRes2 = highRes+range*pft1
lowRes2 = lowRes-range*pft1

//Highlighting Line rules for Profit Target 1
highColor2 = high > highRes2 ? lime : fuchsia
lowColor2 = low < lowRes2 ? lime : fuchsia

//Plots For Profit Target 1
p1=plot(fr2to17 > 0 ? highRes2 : na, color=highColor2, style=circles, linewidth=4)
p2=plot(fr2to17 > 0 ? lowRes2 : na, color=lowColor2, style=circles, linewidth=4)

//Formula For Profit Target 2
pft2 = pt2*.1
highRes3 = highRes+range*pft2
lowRes3 = lowRes-range*pft2

//Highlighting Line rules for Profit Target 2
highColor3 = high > highRes3 ? lime : aqua
lowColor3 = low < lowRes3 ? lime : aqua

//Plots For Profit Targe 2
plot(fr2to17 > 0 ? highRes3 : na, color=highColor3, style=circles, linewidth=4)
plot(fr2to17 > 0 ? lowRes3 : na, color=lowColor3, style=circles, linewidth=4)

//Rules for when to plot Numbers 1 or 2 When Profit Target 1 or 2 is Reached
pt1UHit = (high >= highRes2  and high[1] < highRes2 and high[2] < highRes2 and high[3] < highRes2 and high[4] < highRes2 and high[5] < highRes2) and fr2to17 > 0 
pt1LHit = (low <= lowRes2  and low[1] > lowRes2 and low[2] > lowRes2 and low[3] > lowRes2 and low[4] > lowRes2 and low[5] > lowRes2) and low > lowRes3 and fr2to17 > 0
pt2UHit = (high >= highRes3  and high[1] < highRes3 and high[2] < highRes3 and high[3] < highRes3 and high[4] < highRes3 and high[5] < highRes3) and fr2to17 > 0 
pt2LHit = (low <= lowRes3  and low[1] > lowRes3 and low[2] > lowRes3 and low[3] > lowRes3 and low[4] > lowRes3 and low[5] > lowRes3) and fr2to17 > 0

//Rules for plotting 1 or 2 When Profit Target 1 or 2 is Reached
plotchar(snp and pt1UHit ? pt1UHit : na, title='UpSide Profit Target 1 Achieved', char='1', location=location.abovebar, color=white, transp=0, offset=0)
plotchar(snp and pt1LHit ? pt1LHit : na, title='DownSide Profit Target 1 Achieved', char='1', location=location.belowbar, color=white, transp=0, offset=0)
plotchar(snp and pt2UHit ? pt2UHit : na, title='UpSide Profit Target 2 Achieved', char='2', location=location.abovebar, color=white, transp=0, offset=0)
plotchar(snp and pt2LHit ? pt2LHit : na, title='DownSide Profit Target 2 Achieved', char='2', location=location.belowbar, color=white, transp=0, offset=0)

코멘트

hi Chris, I've been using this super indicator for years, so thank you!
now it seems to have a problem (lines disappearing or way off)
happens when I change e.g. Asia is set from 17:00 to 3:00 (problem starts at 11)
would you please know if/how it can be fixed?
+27 응답
Aderate rhoracio
@rhoracio, Yeh Ho Nahi Sakata
+2 응답
Chris, how can I change the source code to show the range breakout only on the current day vs all days? Thanks
+25 응답
How can I use it for NSE and BSE script? its not working on NSE and MCX (INDIA)
+18 응답
@ChrisMoody , how could I change the code to display the opening range for the 10 minute chart? Thank you in advance.
+14 응답
Chris, love this and it works on SPY, but I want to put on ES Future chart for opening at 9:30am, and it doesn't seem to work there, can't figure out why? Thanks
+5 응답
Hi All

I have added the indicator to my chart, but it doesn't show any dotted lines or plots after the profit! Any idea?
+3 응답
Hello Mister Moody,

Whenever i try to load the script into my tradingview chart it simply doesn't show any lines at all. I simply load the script by adding it to my favourites and select it from the indicators menu.
Strange thing is, the script does work on the tradingview app? (Android).

Can you please help me out as i want to use your indicator for my strategy.
+3 응답
HI Chris,

Is it possible to make this available for thinkorswim?

Thank you
+1 응답
bigboy0531 kaylumtrades
@kaylumtrades, we’re you able to find an orb indicator with targets for thinkorswim?
응답
홈으로 스탁 스크리너 포렉스 스크리너 크립토 스크리너 이코노믹 캘린더 정보 차트 특징 프라이싱 프렌드 리퍼하기 하우스룰(내부규정) 헬프 센터 웹사이트 & 브로커 솔루션 위젯 차팅 솔루션 라이트웨이트 차팅 라이브러리 블로그 & 뉴스 트위터