Opening Range Break Out code for the 5 minute chart


Category:
0
0

Opening Range Break Out code for the 5 minute chart. can any one help

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on April 10, 2018 8:38 am
2543 views
0
Private answer

Not sure if you searched the forum before posting. Check this and see if does the job: https://www.hahn-tech.com/ans/scanning-for-premarket-highs-and-opening-range-breakouts/

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 10, 2018 9:57 am
0

Anthony Tomassi, please do not use the “post your answer” box at the bottom of the thread unless you are providing a new solution to your question. If you only have a comment or clarification to add, do so using comment link below your original question, or one of the answers already posted.

Your answer is being deleted. The contents of your response is listed here:

“Thanks, I did see that it is for a gap up only. I would like a true opening rang breakout, up or down.”

( at April 10, 2018 1:59 pm)
0

Anthony. That code can easily be adjusted to account for the other side. The author of that post only asked for breakouts above opening range high. If you want, I can provide the line of code to add that will measure the other side:

plot scan = low < ORLow; You can combine them into a single statement like this: plot scan = high > ORHigh or low < ORLow;

( at April 10, 2018 2:03 pm)
0

Sorry, thanks for the input. “Thanks, I did see that it is for a gap up only. I would like a true opening rang breakout, up or down.”

( at April 10, 2018 2:15 pm)
0
I am not sure that I have been clear. I would like to see two lines on the chart one for high one for low of the opening range for the breakout. I am new at this so I apologize for my lack of knowledge. I am very thankful for your help. And send an alert.
( at April 10, 2018 2:39 pm)
0

Well you did post this in the “Stock Scanners” topic. So there was no implication that you actually wanted a chart study. Is it actually just a chart study that you wanted? Not a scan?

( at April 10, 2018 2:53 pm)
0

Thank you,

( at April 10, 2018 3:38 pm)
0

???

( at April 10, 2018 3:44 pm)
0

I think I wanted both, a scan to find the breakouts and also showing on the chart. However the scan is my first choice.
Thanks

( at April 10, 2018 3:51 pm)
0

Well the scan is what I gave you. Using the code provided in the post that I linked in my original answer. You simply add this line to create your scan signal:

plot scan = low < ORLow; You can combine them into a single statement like this: plot scan = high > ORHigh or low < ORLow;

( at April 10, 2018 4:00 pm)
0
Private answer

I see that Anthony is looking for both a stock scan as well as a chart study. Everything is provided via the link to the post I provided in my original answer: https://www.hahn-tech.com/ans/scanning-for-premarket-highs-and-opening-range-breakouts/

However it occurs to me not everyone is going to be able to read that post, locate the source code and make the adjustments needed to get things working. So here is the code, provided in the original post, modified to plot the Opening Range on the chart (screenshot shows the result).

#Opening Range Breakout
#http://tradethebid.blogspot.com/p/test.html
input ShowORB = Yes;
input ORBRange = 30;
def Market_Open_Time = 930;
def Market_Close_Time = 1600;
def day = GetDay();
def pastOpen = If((SecondsTillTime(Market_Open_Time) > 0), 0, 1);
def pastClose = If((SecondsTillTime(Market_Close_Time) > 0), 0, 1);
def IsmarketOpen = If(pastOpen and !pastClose, 1, 0);
def firstBar = If (day[1] != day, day – 1, 0);
def secondsUntilOpen = SecondsTillTime(Market_Open_Time);
def regularHours = SecondsTillTime(Market_Close_Time);
def secondsFromOpen1 = SecondsFromTime(Market_Open_Time);
def pastOpeningRange = If(secondsFromOpen1 >= ((ORBRange - 15) * 60), 1, 0);
rec displayedHigh = If(high > displayedHigh[1] and IsmarketOpen and ShowORB, high, If(IsmarketOpen and !firstBar, displayedHigh[1], high));
rec displayedLow = If(low < displayedLow[1] and IsmarketOpen and ShowORB, low, If(IsmarketOpen and !firstBar, displayedLow[1], low));
rec ORHigh = If(pastOpeningRange, ORHigh[1], displayedHigh);
rec ORLow = If(pastOpeningRange, ORLow[1], displayedLow);
plot highOR = ORHigh;
plot lowOR = ORlow;

If you want to use that code in a scan. Simply replace the last two lines with this one:

plot scan = high > ORHigh or low < ORLow;

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 10, 2018 4:18 pm
0

Thank you, this is great. I can’t thank you enough.
Anthony

( at April 11, 2018 11:24 am)
0
This is great Mr. Hahn, Can you please update the script for 2 things? – 1 minute chart – Presently this scan includes tickers for the entire day.  Can you please modify the script to include the ticker only when they break Opening Candle just within the last 3 minutes. Thanks, Markson
( at December 6, 2020 6:29 pm)