0% found this document useful (0 votes)
279 views

ORB

This document defines a study that plots 3 EMA lines and overlays an orb range. It takes in inputs to define the periods of the 3 EMAs and the total time in minutes for the orb range. It then defines the EMA calculations, plots the EMA lines, and implements logic to track the high and low of each new bar within the session time to display the overbought/oversold range.

Uploaded by

Mukram Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
279 views

ORB

This document defines a study that plots 3 EMA lines and overlays an orb range. It takes in inputs to define the periods of the 3 EMAs and the total time in minutes for the orb range. It then defines the EMA calculations, plots the EMA lines, and implements logic to track the high and low of each new bar within the session time to display the overbought/oversold range.

Uploaded by

Mukram Khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//@version=4

study(title="3EMA-ORB", shorttitle="3EMA-ORB", overlay=true, resolution="")

MA1Period = input(48, title="MA1 Period")


MA2Period = input(48, title="MA2 Period")
MA3Period = input(20, title="MA3 Period")

MA1 = ema(high, MA1Period)


MA2 = ema(low, MA2Period)
MA3 = ema(close, MA3Period)

plot(MA1, color=color.green, linewidth=1)


plot(MA2, color=color.red, linewidth=1)
plot(MA3, color=color.blue, linewidth=1)

//3EMA
inputMax = input(5, title= "ORB total time (minutes)")
sess = input("0915-0920", type=input.session, title="Session Time")
t = time(timeframe.period, sess + ":1234567")
hide = timeframe.isintraday and timeframe.multiplier <= inputMax

is_newbar(res) => change(time(res)) != 0


in_session = not na(t)
is_first = in_session and not in_session[1]

orb_high = float(na)
orb_low = float(na)

if is_first
orb_high := high
orb_low := low
else
orb_high := orb_high[1]
orb_low := orb_low[1]
if high > orb_high and in_session
orb_high := high
if low < orb_low and in_session
orb_low := low

plot(hide ? orb_high : na , style=plot.style_line, color=orb_high[1] != orb_high ?


na : color.green, title="ORB High", linewidth=2)
plot(hide ? orb_low : na , style=plot.style_line, color=orb_low[1] != orb_low ?
na : color.red, title="ORB Low", linewidth=2)

You might also like