0% found this document useful (0 votes)
161 views6 pages

ROM Study

Uploaded by

hocm.sam
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)
161 views6 pages

ROM Study

Uploaded by

hocm.sam
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

/ This source code is subject to the terms of the Mozilla Public License 2.

0 at
https://mozilla.org/MPL/2.0/
// © IOTABHI

//@version=5

indicator('Vibs - Trading Assistant', overlay=true)

// inputs
studyoh = input(true, title='Show open=high Bars?')
rom = input(true, title="Show Range of Market?")
sma = input(true, title="Show SMA?")
targets = input(true, title="Show Target?")
suppres = input(true, title="Show Support & Resistance?")

length = input.int(19, title="BBands Length", minval=1, tooltip="Bollinger band


length used in calculation", group="Reversal Bar")
mult = input.float(2, title="BBands Multiplier", minval=0.001, maxval=50,
tooltip="Bollinger band multiplier used in calculation", group="Reversal Bar")
showCheckmarks = input.bool( true , title="Show Checkmarks", tooltip="Checkmarks
provide confirmation", group="Reversal Bar")
showTrendBars = input.bool( true , title="Show TrendBars", tooltip="Show red/green
trend bars based on SuperTrend", group="Trend Bars")
atrPeriod = input(10, "ATR Length", group="Trend Bars")
factor = input.float(3.0, "Factor", step = 0.01,group="Trend Bars")
isRsi = input.bool( false , title="RSI confluence", tooltip="Show reversal signal
only when RSI is overbought/oversold", group="RSI")
rsiLen = input.int( 14 , title="RSI Length", group="RSI")
overSold = input.int( 30 , title="RSI Oversold", group="RSI")
overBought = input.int ( 70 , title="RSI Overbought", group="RSI")

// tooltip_text = "Some timeframes may not be displayed in current timeframe."


// time_frame= input.string("Chart", "Timeframe", ["Chart", "5m", "15m", "30m",
"1h", "2h", "4h", "D"], tooltip=tooltip_text)

// tf = switch time_frame
// "5m" => "5"
// "15m" => "15"
// "30m" => "30"
// "1h" => "60"
// "2h" => "120"
// "4h" => "240"
// "D" => "D"
// => timeframe.period

//Open High
ohcandle() =>
studyoh and open == high and low != close ? 1 : 0
mohcandle() =>
studyoh and open == high and low == close ? 1 : 0
molcandle() =>
studyoh and open == low and high == close ? 1 : 0

//10 SMA
smaValue = ta.sma(close, 50)
plot(sma and smaValue ? smaValue : na, color=color.red, linewidth = 2)

//open high
barcolor(ohcandle() ? color.rgb(0, 0, 0) : na)
barcolor(mohcandle() ? color.yellow : na)
barcolor(molcandle() ? color.orange : na)
plotshape(ohcandle(), style=shape.arrowdown)

h = 9 //For starting new session from 09:15


m = 15// For starting new session from 09:15
is_new_session = (hour == h) and (minute == m) // Confirm the session is new

var float first_high = na // Block start defining variables


var float first_low = na
var float candle_height = first_high - first_low

var float T1 = first_high + (candle_height *0.5)


var float T2 = first_high + (candle_height *1.0)
var float T3 = first_high + (candle_height *2.0)
var float T4 = first_high + (candle_height *3.0)
var float T5 = first_high + (candle_height *5.0)

var float T6 = first_low - (candle_height *0.5)


var float T7 = first_low - (candle_height *1.0)
var float T8 = first_low - (candle_height *2.0)
var float T9 = first_low - (candle_height *3.0)
var float T10 = first_low - (candle_height *5.0)

var bool can_draw = true


var line Fmh = na
var line TL1 = na
var line TL2 = na
var line TL3 = na
var line TL4 = na
var line TL5 = na
var line Fml = na

var line sl_ll = na


var line TL6 = na
var line TL7 = na
var line TL8 = na
var line TL9 = na
var line TL10 = na

var box TB1 = na


var box TB2 = na

if (is_new_session)
first_high := high
first_low := low
candle_height := first_high - first_low
T1 := first_high + (candle_height *0.5)
T2 := first_high + (candle_height *1.0)
T3 := first_high + (candle_height *2.0)
T4 := first_high + (candle_height *3.0)
T5 := first_high + (candle_height *5.0)

T6 := first_low - (candle_height *0.5)


T7 := first_low - (candle_height *1.0)
T8 := first_low - (candle_height *2.0)
T9 := first_low - (candle_height *3.0)
T10 := first_low - (candle_height *5.0)

// Fmh := line.new(rom and bar_index ? bar_index : na, first_high, bar_index,


first_high, color=color.green,style=line.style_dotted)
// line.set_x2(Fmh, rom and bar_index ? bar_index : na)

TL1 := line.new(rom and bar_index ? bar_index : na, T1, bar_index, T1,


color=#27AE60,width = 1,style=line.style_solid)
TL2 := line.new(rom and bar_index ? bar_index : na, T2, bar_index, T2,
color=#27AE60,width = 1,style=line.style_solid)
TB1 := box.new(bar_index, T1, bar_index, T2, border_color = na, bgcolor =
#27ae5f21)
int(na)

TL3 := line.new(targets and bar_index ? bar_index : na, T3, bar_index,


T3 ,style=line.style_dotted, color = color.blue)
TL4 := line.new(targets and bar_index ? bar_index : na, T4, bar_index,
T4,style=line.style_dotted, color = color.blue)
TL5 := line.new(targets and bar_index ? bar_index : na, T5, bar_index,
T5,style=line.style_dotted, color = color.blue)

// Fml := line.new(rom and bar_index ? bar_index : na, first_low, bar_index,


first_low, color=color.red,style=line.style_dotted)
// line.set_x2(Fml, rom and bar_index ? bar_index : na)

TL6 := line.new(rom and bar_index ? bar_index : na, T6, bar_index, T6,


color=#E74C3C,width = 1,style=line.style_solid)
TL7 := line.new(rom and bar_index ? bar_index : na, T7, bar_index, T7,
color=#E74C3C,width = 1,style=line.style_solid)
TB2 := box.new(bar_index, T6, bar_index, T7, border_color = na, bgcolor =
#e74d3c2f)
int(na)

TL8 := line.new(targets and bar_index ? bar_index : na, T8, bar_index, T8,


style=line.style_dotted, color = color.blue)
TL9 := line.new(targets and bar_index ? bar_index : na, T9, bar_index, T9,
style=line.style_dotted, color = color.blue)
TL10 := line.new(targets and bar_index ? bar_index : na, T10, bar_index, T10,
style=line.style_dotted, color = color.blue)

else

//line.set_x2(Fmh, rom and bar_index ? bar_index : na)


line.set_x2(TL1, rom and bar_index ? bar_index : na)
line.set_x2(TL2, rom and bar_index ? bar_index : na)
box.set_right(TB1, bar_index)
int(na)

line.set_x2(TL3, targets and bar_index ? bar_index : na)


line.set_x2(TL4, targets and bar_index ? bar_index : na)
line.set_x2(TL5, targets and bar_index ? bar_index : na)
//line.set_x2(Fml, rom and bar_index ? bar_index : na)
line.set_x2(TL6, rom and bar_index ? bar_index : na)
line.set_x2(TL7, rom and bar_index ? bar_index : na)
box.set_right(TB2, bar_index)
int(na)
line.set_x2(TL8, targets and bar_index ? bar_index : na)
line.set_x2(TL9, targets and bar_index ? bar_index : na)
line.set_x2(TL10, targets and bar_index ? bar_index : na)

//Support & Resistance

resistance1 = ta.highest(close, 15)


resistance2 = ta.highest(close, 50)
resistance3 = ta.highest(close, 125)

high_line1 = line.new(bar_index[15],suppres and resistance1 ? resistance1 :


na,bar_index,suppres and resistance1 ? resistance1 : na,
color = color.rgb(255, 82, 82, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(high_line1[1])

high_line2 = line.new(bar_index[50],suppres and resistance2 ? resistance2 :


na,bar_index,suppres and resistance2 ? resistance2 : na,
color = color.rgb(255, 82, 82, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(high_line2[1])

high_line3 = line.new(bar_index[125],suppres and resistance3 ? resistance3 :


na,bar_index,suppres and resistance3 ? resistance3 : na,
color = color.rgb(255, 82, 82, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(high_line3[1])

support1 = ta.lowest(close, 20)


support2 = ta.lowest(close, 175)
support3 = ta.lowest(close, 220)

low_line4 = line.new(bar_index[40],suppres and support1 ? support1 :


na,bar_index,suppres and support1 ? support1 : na,
color = color.rgb(33, 149, 243, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(low_line4[1])

low_line5 = line.new(bar_index[80],suppres and support2 ? support2 :


na,bar_index,suppres and support2 ? support2 : na,
color = color.rgb(49, 27, 146, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(low_line5[1])

low_line6 = line.new(bar_index[200],suppres and support3 ? support3 :


na,bar_index,suppres and support3 ? support3 : na,
color = color.rgb(76, 175, 79, 70),
style=line.style_solid,
extend=extend.right,
width=10)
line.delete(low_line6[1])

//Reversal

//calculate bollinger bands


basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upper = basis + dev
lower = basis - dev

//calculate RSI
vrsi = ta.rsi(close, rsiLen)
rsiBull = ta.crossover(vrsi, overSold)
rsiBear = ta.crossunder(vrsi, overBought)

// Reversal Bar - Bullish Signal


// Pseudo: went out lower band AND red candle AND came back in AND green candle
bullReversal = low[1]<lower[1] and close[1]<open[1] and close>lower and close>open
// Pseudo: everything above AND candle close above signal candles wick.
bullReversalConfirm = low[2]<lower[2] and close[2]<open[2] and close[1]>lower[1]
and close[1]>open[1] and close>high[1]

// Reversal Bar - Bearish Signal


// Pseudo: went out upper band AND green candle AND came back in AND red candle
bearReversal = high[1]>upper[1] and close[1]>open[1] and close<upper and
close<open
// Pseudo: everything above AND candle close below signal candles wick.
bearReversalConfirm = high[2]>upper[2] and close[2]>open[2] and close[1]<upper[1]
and close[1]<open[1] and close<low[1]

if isRsi
bullReversal:=bullReversal and rsiBull
bearReversal:=bearReversal and rsiBear
bullReversalConfirm:=false
bearReversalConfirm:=false

//calculate super trend for green/red bars


[unused, direction] = ta.supertrend(factor, atrPeriod)

// UI
plotchar(bullReversal, "Bull Reversal", "R",
location.belowbar,color.green,size=size.tiny)
plotchar(bearReversal, "Bear Reversal", "R",
location.abovebar,color=color.red,size=size.tiny)
plotchar(showCheckmarks?bullReversalConfirm:na, "Bull Reversal Confirm", "",
location.belowbar, text="✓", color=color.green,size=size.tiny)
plotchar(showCheckmarks?bearReversalConfirm:na, "Bear Reversal Confirm", "",
location.abovebar, text="✓", color=color.red,size=size.tiny)
// barcolor(bullReversal?color.rgb(124, 251, 216):na, title="Bull Reversal Bar")
// barcolor(bearReversal?color.yellow:na, title="Bear Reversal Bar")
// barcolor(showTrendBars?(direction<0?color.green:color.red):na, title="Trend
Bars")
//Alerts
alertcondition(bullReversal or bearReversal or bullReversalConfirm or
bearReversalConfirm, "All - Bull/Bear - Reversal/Confirmed", "{{ticker}}
{{interval}}m, Reversal/Confirmed Signal")
alertcondition(bullReversal or bearReversal, "Bull/Bear - Only Potential
Reversals", "{{ticker}} {{interval}}m, Potential Reversal Signal")
alertcondition(bullReversalConfirm or bearReversalConfirm, "Bull/Bear - Only
Confirmed Reversals", "{{ticker}} {{interval}}m, Confirmed Reversal Signal")
alertcondition(bullReversal, "Potential Bullish Reversal", "{{ticker}}
{{interval}}m, Potential Bullish Reversal")
alertcondition(bearReversal, "Potential Bearish Reversal", "{{ticker}}
{{interval}}m, Potential Bearish Reversal")
alertcondition(bullReversalConfirm, "Confirmed Bullish Reversal", "{{ticker}}
{{interval}}m, Confirmed Bullish Reversal")
alertcondition(bearReversalConfirm, "Confirmed Bearish Reversal", "{{ticker}}
{{interval}}m, Confirmed Bearish Reversal")

You might also like