TradingView
equitydurai81
20 ינו׳ 2020 19:16

ORB 15 Min By EquityDurai 

TECH MAHINDRANSE

תיאור

#Let the index/stock trade for the first fifteen minutes and then use the high and low of this "fifteen minute range" as support and resistance levels.
#A buy signal is given when price exceeds the high of the 15 minute range after an up gap.
#A sell signal is given when price moves below the low of the 15 minute range after a down gap.
#It's a simple technique that works like a charm in many cases.

>If you use this technique, though, a few caveats are in order to avoid whipsaws and other market traps.
>The most common whipsaw is a trading range that lasts longer than 15 minutes.
>If an obvious range builds in 20, 25 or even 30 minutes , use those to define your support and resistance levels.
>Also consider the higher noise level in the morning.
>A breakout that extends only a tick or two can be easily reversed and trap you in a sudden loss.
>So let others take the bait at these levels, while you find pullbacks and narrow range bars for trade execution.

הערות שחרור

#Let the index/stock trade for the first fifteen minutes and then use the high and low of this "fifteen minute range" as support and resistance levels.
#A buy signal is given when price exceeds the high of the 15 minute range after an up gap.
#A sell signal is given when price moves below the low of the 15 minute range after a down gap.
#It's a simple technique that works like a charm in many cases.

>If you use this technique, though, a few caveats are in order to avoid whipsaws and other market traps.
>The most common whipsaw is a trading range that lasts longer than 15 minutes.
>If an obvious range builds in 20, 25 or even 30 minutes , use those to define your support and resistance levels.
>Also consider the higher noise level in the morning.
>A breakout that extends only a tick or two can be easily reversed and trap you in a sudden loss.
>So let others take the bait at these levels, while you find pullbacks and narrow range bars for trade execution.
תגובות
ClikermanRP
hi awesome script. I need a script to mark the 3rd 15mins candle high and low.
please guide me bro
VivekBharti
@ClikermanRP,

// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © VivekBharti

//@version=4
study("Open Range Breakout",overlay=true)

tf = input(title="Resolution",type = input.resolution,defval = "60") //which timeframe you want to move
session = input(title="Breakout Timings",defval="1000-1015", type=input.session)
linew = input(title="Line Width",type = input.integer, defval=2,minval=1,maxval=5)

//is the market trading in between the session timings? If yes then it returns true
Barsinsession(session) => time(tf,session) != 0 //single line function

Insession = Barsinsession(session) ? 1 : 0
endofsession = Insession == 0 and Insession[1] == 1 //end of the session if it is happening -> returns ture

//high value and low value from 15min timeframe charts
hi = security(syminfo.tickerid,tf,high)
lo = security(syminfo.tickerid,tf,low)

orbh = valuewhen(endofsession,hi,0) //first time computation
orbl = valuewhen(endofsession,lo,0)

orbh := Barsinsession(session) ? na : orbh //rewriting the value storing a different value
orbl := Barsinsession(session) ? na : orbl //rewriting the value storing a different value

Buy = crossover(high,orbh)
Short = crossunder(low,orbl)

//flip
Buycontinue = barssince(Buy) < barssince(Short)
Shortcontinue = barssince(Short) < barssince(Buy)

newday = dayofmonth != dayofmonth[1]

var isLong = false
var isShort = false

//exrem
Buy := not isLong and Buy
Short := not isShort and Short

if Buy
isLong := true
isShort := false

if Short
isLong := false
isShort := true

if newday[1]
isLong := false
isShort := false

//indicates the buy or sell signal
plotshape(Buy,style=shape.labelup,location = location.belowbar,color=color.green,title = "Buy",text="Buy",textcolor=color.white)
plotshape(Short,style=shape.labeldown,location = location.abovebar,color=color.red,title = "Sell",text="Sell",textcolor=color.white)

alertcondition(Buy, title='Buy Alert', message='Buy Signal!')
alertcondition(Short, title='Short Alert', message='Short Signal!')

plot(orbh,color=color.red,style=plot.style_line,linewidth=linew)
plot(orbl,color=color.green,style=plot.style_line,linewidth=linew)
PragNATRADER
@VivekBharti, 48
.labelup,location = location.belowbar,color=color.green,title = "Buy",text="Buy",textcolor=color.white)
plotshape(Short,style=shape.labeldown,location = location.abovebar,color=color.red,title = "Sell",text="Sell",textcolor=color.white)

alertcondition(Buy, title='Buy Alert', message='Buy Signal!')
alertcondition(Short, title='Short Alert', message='Short Signal!')

plot(orbh,color=color.red,style=plot.style_line,linewidth=linew)
plot(orbl,color=color.green,style=plot.style_line,linewidth=linew)// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © bpraveensharma

7:08:10 AM 'Untitled script' opened
7:08:38 AM Compiling...
7:08:38 AM Error at 40:1 Mismatched input 'isLong' expecting 'end of line without line continuation'
7:08:38 AM 'ORB NEXT 15 MIN CANDLE' saved.
7:08:40 AM Compiling...
7:08:43 AM Error at 40:1 Mismatched input 'isLong' expecting 'end of line without line continuation'
Kerasi
Great job.
If I want the script to start from 0930 - 1030 then end at end of day? (equities use)

Thank you
parisseine
An excellent way to see the opening trend thanks to that opening range script.
The duration of the opening can be a variable instead of 15 minutes only, let's say X the value in minutes and below I set 2 hours (120 minutes) instead of 15 for the OR as for an example:

up15on = input(true, title="X Minute Opening Range High")
down15on = input(true, title="X Minute Opening Range Low")
X=input("120")
is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(syminfo.tickerid,r, s)

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

high_rangeL = valuewhen(is_newbar('D'),high,0)
low_rangeL = valuewhen(is_newbar('D'),low,0)

up15 = plot(up15on ? adopt(X, high_rangeL): na, color = color.lime, linewidth=2)
down15 = plot(down15on ? adopt(X, low_rangeL): na, color = #ff0000, linewidth=2)
Selvanagarajan
@parisseine,

// TimeFrame = TF; Opening Range High = ORH; Opening Range Low = ORL; Opening Range Average = ORA
study(title="TESTING ORB", shorttitle="TESTING ORB", overlay=true)

TF=input("120")
is_newbar(res) => change(time(res)) != 0

adopt(r, s) => security(tickerid, r, s)

ORH = valuewhen(is_newbar('D'), high, 0)
ORL = valuewhen(is_newbar('D'), low, 0)
ORA = (ORH + ORL)/2

High = plot(adopt(TF, ORH), color = #000000, linewidth = 2)
Low = plot(adopt(TF, ORL), color = #000000, linewidth = 2)
Average = plot(adopt(TF, ORA), color = #787B86, linewidth = 2)
//
jaymakwana50
@parisseine, what should be the code if i want to create strategy, where vwap cross ORH buy and exit @ 3:15 and vwap cross ORL sell and exit same. or price close above buy / sell when close below
srsivasekhar
HI i tried in my chart , but only getting a single line , low line is missing , any solutions ?
sunnetww
for futures , I am getting HL and LL seperately. However, for stocks, the same script is giving only 1 line. What could be the issue?
עוד