Está en la página 1de 13

//@version=5

// NOTE: ¡Para el grupo VIP de Hagamos Profits, un cordial saludo y buenos profits!

//
indicator("Hagamos Profits 3.0", "Hagamos Profits 3.0", true, max_lines_count=500,
max_boxes_count=500)

// INPUTS

i_time = input.session('0000-0001:1234567',"TRADING POR CICLOS", tooltip="¡NO


TOCAR!", group="【GRUPO VIP BY HAGAMOS PROFITS】")

// Hagamos Profits HPH 1.0


var HPH = 'HORARIOS: RANGOS HORARIOS GENERALES'

i_rshow = input.bool (true, title='Mostrar Horarios', tooltip =


"Mostrar/Ocultar Horarios en el grafico", group=HPH)
i_maxtf = input.int (15, "Temporalidad maxima", 1, 240,
tooltip="Hasta que temporalidad se ve el indicador en el grafico. Se debe
configurar en minutos, 1 hr = 60 minutos", group=HPH)

TOOLTIP02 = "Ingresa el tiempo que corresponda segun tu pais (UTC -#)"


hoursOffsetInput2 = input.string('-3', "Tiempo de zona segun tu pais (UTC)",
inline='x1', tooltip = TOOLTIP02, group=HPH)
TIMEZONE2 = "GMT"+hoursOffsetInput2

i_bool1 = input.bool (true, "HM 1", inline='x2', group=HPH)


i_bool2 = input.bool (true, "HM 2", inline='x3', group=HPH)
i_bool3 = input.bool (true, "Asia", inline='x4', group=HPH)
i_bool4 = input.bool (true, "Apertura de Londres", inline='x5',
group=HPH)
i_bool5 = input.bool (true, "Trampa NY", inline='x6', group=HPH)
i_bool6 = input.bool (true, "Cierre de Londres", inline='x7',
group=HPH)
i_bool7 = input.bool (true, "Frankfurt", inline='x8', group=HPH)

horario1 = input.session ('0530-0540:1234567', "" ,


inline='x2', tooltip="5:30", group=HPH)
horario2 = input.session ('0730-0740:1234567', "" ,
inline='x3', tooltip="7:30", group=HPH)
asia = input.session ('1800-0201:1234567', "", inline='x4',
tooltip="Asia", group=HPH)
london = input.session ('0400-0501:1234567', "", inline='x5',
tooltip="Apertura de Londres", group=HPH)
nysesh = input.session ('1000-1101:1234567', "", inline='x6',
tooltip="Trampa de New York", group=HPH)
lcsesh = input.session ('1155-1206:1234567', "", inline='x7',
tooltip="Cierre de Londres", group=HPH)
frankfurt = input.session ('0300-0305:1234567', "", inline='x8',
tooltip="Frankfurt", group=HPH)

i_vhorario1 = input.color (color.new(#0064ff, 70), "",


inline='x2', group=HPH)
i_vhorario2 = input.color (color.new(#f57f17, 70), "",
inline='x3', group=HPH)
i_vasia = input.color (color.new(#7622ff, 70), "",
inline='x4', group=HPH)
i_vlon = input.color (color.new(#e90000, 70), "",
inline='x5', group=HPH)
i_vny = input.color (color.new(#00cbff, 70), "",
inline='x6', group=HPH)
i_lc = input.color (color.new(color.silver, 70),"",
inline='x7', group=HPH)
i_vfrankfurt = input.color (color.new(#ffe500, 70),"",
inline='x8', group=HPH)

i_btc = input.bool (false, "Mostrar nombres", inline="x9",


group=HPH)
i_tcb = input.color (color.new(color.gray, 20), "",
inline="x9", group=HPH)

//INPUTS END

// MISC
nymid = time ("1", i_time, 'GMT-3')
dow = dayofweek == dayofweek.friday ? 259200000 : 86400000
dow2 = dayofweek == dayofweek.friday ? 172800000 : 86400000 //
dow3 = dayofweek == dayofweek.friday ? 172800000 : 0

disp = timeframe.isintraday and timeframe.multiplier <= i_maxtf

// CALC
var openprice = 0.0
if nymid
if not nymid[1]
openprice := open
else
openprice := math.max(open, openprice)

// FUNCTIONS
in_session(sess) =>
not na(time(timeframe.period, sess, TIMEZONE2))

start_time(sess) =>
int startTime = na
startTime := in_session(sess) and not in_session(sess)[1] ? time : startTime[1]
startTime

is_new_session(res, sess) =>


t = time(res, sess, TIMEZONE2)
na(t[1]) and not na(t) or t[1] < t

BarInSession(sess) =>
time(timeframe.period, sess, TIMEZONE2) != 0

// OBJECTS
var label lb = na
if openprice != openprice[1] and disp
var line lne = na
line.set_x2(lne, nymid)
line.set_extend(lne, extend.none)

f_vline(a, b, d, e, sess) =>


var line fl1 = na
var line fl2 = na
var linefill lf1 = na
st_vl = timestamp(TIMEZONE2, year, month, sess, a, 00, 00)
en_vl = timestamp(TIMEZONE2, year, month, sess, b, e, 00)
line.delete(fl1[1])
line.delete(fl2[1])
lf1 := linefill.new(fl1, fl2, color.new(d, 90))
linefill.delete(lf1[1])
for i = 0 to 100
if time > line.get_x1(fl2[i])
line.delete(fl2[i])
line.delete(fl1[i])

//CAJAS - FONDOS - RANGOS

ictbox(kz, bdcol,txt, x)=>


sesh = is_new_session('1440', kz)
float kzlow = na
float kzhigh = na
float kzbodlow = na
float kzbodhigh = na

kzbox = box(na)
bline = line(na)
bline2 = line(na)
kzstart = start_time(kz)
kzlow := sesh ? low : in_session(kz) ? math.min(low, kzlow[1]) : na
kzhigh := sesh ? high : in_session(kz) ? math.max(high, kzhigh[1]) : na
kzbodlow := sesh ? open : in_session(kz) ? math.min(open, kzbodlow[1]) : na
kzbodhigh := sesh ? open : in_session(kz) ? math.max(open, kzbodhigh[1]) : na
devdiff = kzbodhigh[1] - kzbodlow[1]

if in_session(kz)
if in_session(kz)[1]
box.delete(kzbox[1])

if low < kzlow


kzlow := low
kzlow
if high > kzhigh
kzhigh := high
kzhigh

if i_rshow and x
kzbox := box.new(kzstart, kzhigh, time, kzlow, color.new(bdcol, 100),
1, line.style_solid, extend.none, xloc.bar_time, bdcol, i_btc ? txt : na,
size.auto, i_tcb, text_wrap=text.wrap_auto)
kzbox

tz = time - time[1]

if disp
ictbox(asia, i_vasia, "Asia", i_bool3)
ictbox(horario1, i_vhorario1, "HM 1", i_bool1)
ictbox(london, i_vlon, "Apertura de Londres", i_bool4)
ictbox(nysesh, i_vny, "Trampa de NY", i_bool5)
ictbox(lcsesh, i_lc, "Cierre de Londres", i_bool6)
ictbox(horario2, i_vhorario2, "HM 2", i_bool2)
ictbox(frankfurt, i_vfrankfurt, "FRANKFURT", i_bool7)

//END

// HAGAMOS PROFITS HORARIOS 2.0

//BIG BOX SESSIONS CONTINUACION

// -------------------- INPUTS --------------------

//BIG BOXES

var grp1 = 'ZONAS GRANDES & LINEAS: HAGAMOS PROFITS 2.0'

TOOLTIP01 = "Ingresa el tiempo que corresponda segun tu pais (UTC -#)"


hoursOffsetInput = input.string('-3', "Tiempo de zona segun tu pais (UTC)",
inline='1', tooltip = TOOLTIP01, group=grp1)
TIMEZONE = "GMT"+hoursOffsetInput

frankfurtText = input.string('Frankfurt', title='', inline='2', group=grp1)


frankfurtTime = input.session(title='', defval='0300-0301', inline='2', group=grp1)
frankfurtColor = input.color(color.new(#ffe500, 0), title='', inline='2',
group=grp1)
frankfurtShow = input.bool(true, title='', inline='2', group=grp1)

session1Text = input.string('Apertura de London', title='', inline='3', group=grp1)


session1Time = input.session(title='', defval='0400-0501', inline='3', group=grp1)
session1Color = input.color(color.new(#ff1100, 100), title='', inline='3',
group=grp1)
session1Show = input.bool(true, title='', inline='3', group=grp1)

Horario1Text = input.string('HM1 Zone', title='', inline='4', group=grp1)


Horario1Time = input.session(title='', defval='0530-0531', inline='4', group=grp1)
Horario1Color = input.color(color.new(#0064ff, 0), title='', inline='4',
group=grp1)
Horario1Show = input.bool(true, title='', inline='4', group=grp1)

Horario2Text = input.string('HM2 Zone', title='', inline='5', group=grp1)


Horario2Time = input.session(title='', defval='0730-0731', inline='5', group=grp1)
Horario2Color = input.color(color.new(#f57f17, 0), title='', inline='5',
group=grp1)
Horario2Show = input.bool(true, title='', inline='5', group=grp1)

session2Text = input.string('Apertura de New York', title='', inline='6',


group=grp1)
session2Time = input.session(title='', defval='0900-0901', inline='6', group=grp1)
session2Color = input.color(color.new(#006064, 0), title='', inline='6',
group=grp1)
session2Show = input.bool(true, title='', inline='6', group=grp1)
nyText = input.string('Trampa NY', title='', inline='7', group=grp1)
nyTime = input.session(title='', defval='1000-1101', inline='7', group=grp1)
nyColor = input.color(color.new(#00cbff, 100), title='', inline='7', group=grp1)
nyShow = input.bool(true, title='', inline='7', group=grp1)

session3Text = input.string('Cierre de London', title='', inline='8', group=grp1)


session3Time = input.session(title='', defval='1200-1301', inline='8', group=grp1)
session3Color = input.color(color.new(#b2b5be, 100), title='', inline='8',
group=grp1)
session3Show = input.bool(true, title='', inline='8', group=grp1)

session4Text = input.string('Asia Session', title='', inline='9', group=grp1)


session4Time = input.session(title='', defval='1800-0201', inline='9', group=grp1)
session4Color = input.color(color.new(#7622ff, 100), title='', inline='9',
group=grp1)
session4Show = input.bool(true, title='', inline='9', group=grp1)

bgType = input.string(title='Type', defval='Line', options=['Background', 'Line'],


inline='10', group=grp1, tooltip="Si cambias a fondo, asegurate de bajar la
trasparencia")
linePosition = input.string(title='Posicion de lineas', defval='Top',
options=['Top', 'Bottom'], inline='10', group=grp1)

//TABLA DE SESIONES

var grp2 = "TABLA DE SESIONES: Muestra los horarios claves proximos"


showTable = input.bool(false, title='Mostrar tabla de sesiones', inline='1',
group=grp2)
showNextSession = input.bool(false, title='Mostrar siguiente sesion', tooltip= "Nos
muestra si estamos en un horario importante y el horario clave proximo",
inline='1', group=grp2)
theme = input.string(title='Colores', defval='Dark', options=['Dark', 'Light'],
inline='2', group = grp2)
position = input.string(title='Posicion', defval='Arriba a la derecha',
options=['Arriba a la derecha', 'Arriba a la izquierda', 'Abajo a la derecha',
'Abajo a la izquierda'], inline='2', group = grp2)
alignment = input.string(title='Alineacion', defval='Horizontal',
options=['Vertical', 'Horizontal'], inline='3', group = grp2)
noSessionText = input.string('-', title='Ningun horario texto', tooltip= "Texto que
nos indica que NO estamos en un horario importante. Modificar a gusto", inline='3',
group=grp2)

// -------------------- INPUTS --------------------

// -------------------- FUNCTIONS --------------------


_color1 = theme == "Dark" ? color.white : color.black
_transparent = color.new(color.white, 100)

vline(BarIndex, Color, LineStyle, LineWidth) =>


return_1 = line.new(BarIndex, low - ta.tr, BarIndex, high + ta.tr,
xloc.bar_index, extend=extend.both, color=Color, style=LineStyle, width=LineWidth)
return_1

timeTillPeriodEnd(sess, _type = 1) =>


sessionEnd = array.get(str.split(sess, '-'), _type)
int endHour = math.round(str.tonumber(str.substring(sessionEnd, 0, 2)))
int endMinute = math.round(str.tonumber(str.substring(sessionEnd, 2, 4)))
tsNow = timestamp(TIMEZONE, year(time, TIMEZONE), month(time, TIMEZONE),
dayofmonth(time, TIMEZONE), hour(time, TIMEZONE), minute(time, TIMEZONE))
tsEnd = timestamp(TIMEZONE, year(time, TIMEZONE), month(time, TIMEZONE),
dayofmonth(time, TIMEZONE), endHour, endMinute)
timeRemaining = tsEnd - tsNow < 0 ? math.round(((tsEnd+86400000) - tsNow) /
1000) : math.round((tsEnd - tsNow) / 1000)

days = math.floor(timeRemaining / 86400)


hours = math.floor((timeRemaining % 86400) / 3600)
minutes = math.floor((timeRemaining % 3600) / 60)
seconds = timeRemaining % 60
[hours, minutes, seconds]

resolutionInMinutes() =>
resInMinutes = timeframe.multiplier * (timeframe.isseconds ? 1. / 60 :
timeframe.isminutes ? 1. : timeframe.isdaily ? 60. * 24 : timeframe.isweekly ? 60.
* 24 * 7 : timeframe.ismonthly ? 60. * 24 * 30.4375 : na)
int(resInMinutes)
// -------------------- FUNCTIONS --------------------

// -------------------- SESSIONS --------------------


sess7 = frankfurtShow ? time(timeframe.period, frankfurtTime, TIMEZONE) : na
sess1 = session1Show ? time(timeframe.period, session1Time, TIMEZONE) : na
sess5 = Horario1Show ? time(timeframe.period, Horario1Time, TIMEZONE) : na
sess6 = Horario2Show ? time(timeframe.period, Horario2Time, TIMEZONE) : na
sess2 = session2Show ? time(timeframe.period, session2Time, TIMEZONE) : na
sess8 = nyShow ? time(timeframe.period, nyTime, TIMEZONE) : na
sess3 = session3Show ? time(timeframe.period, session3Time, TIMEZONE) : na
sess4 = session4Show ? time(timeframe.period, session4Time, TIMEZONE) : na

// -------------------- SESSIONS --------------------

// -------------------- PLOT --------------------


bgcolor(not na(sess1) and bgType == 'Background' and timeframe.isintraday == true ?
session1Color : na, title='Fondo - Apertura de Londres')
bgcolor(not na(sess2) and bgType == 'Background' and timeframe.isintraday == true ?
session2Color : na, title='Fondo - Apertura New York')
bgcolor(not na(sess3) and bgType == 'Background' and timeframe.isintraday == true ?
session3Color : na, title='Fondo - Cierre de Londres')
bgcolor(not na(sess4) and bgType == 'Background' and timeframe.isintraday == true ?
session4Color : na, title='Fondo - Sesion Asiatica')
bgcolor(not na(sess5) and bgType == 'Background' and timeframe.isintraday == true ?
Horario1Color : na, title='Fondo - HM1 zone')
bgcolor(not na(sess6) and bgType == 'Background' and timeframe.isintraday == true ?
Horario2Color : na, title='Fondo - HM2 zone')
bgcolor(not na(sess7) and bgType == 'Background' and timeframe.isintraday == true ?
frankfurtColor : na, title='Fondo - Frankfurt')
bgcolor(not na(sess8) and bgType == 'Background' and timeframe.isintraday == true ?
nyColor : na, title='Fondo - Trampa NY')

_linPos = linePosition == 'Top' ? location.top : location.bottom


plotshape(not na(sess1) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Apertura de Londres', style=shape.square, location=_linPos,
color=session1Color, size=size.auto)
plotshape(not na(sess2) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Apertura de New York', style=shape.triangledown, location=_linPos,
color=session2Color, size=size.tiny)
plotshape(not na(sess3) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Cierre de Londres', style=shape.square, location=_linPos,
color=session3Color, size=size.tiny)
plotshape(not na(sess4) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Sesion Asiatica', style=shape.square, location=_linPos,
color=session4Color, size=size.auto)
plotshape(not na(sess5) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - HM1 zone', style=shape.triangledown, location=_linPos,
color=Horario1Color, size=size.tiny)
plotshape(not na(sess6) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - HM2 zone', style=shape.triangledown, location=_linPos,
color=Horario2Color, size=size.tiny)
plotshape(not na(sess7) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Frankfurt', style=shape.triangledown, location=_linPos,
color=frankfurtColor, size=size.tiny)
plotshape(not na(sess8) and bgType == 'Line' and timeframe.isintraday == true,
title='Lineas - Trampa NY', style=shape.square, location=_linPos, color=nyColor,
size=size.auto)

// -------------------- PLOT --------------------

// -------------------- SESSIONS LOGIC --------------------


sessions_arr = array.new_string(0)

if frankfurtShow
array.push(sessions_arr, '1')
if session1Show
array.push(sessions_arr, '2')
if Horario1Show
array.push(sessions_arr, '3')
if Horario2Show
array.push(sessions_arr, '4')
if session2Show
array.push(sessions_arr, '5')
if nyShow
array.push(sessions_arr, '6')
if session3Show
array.push(sessions_arr, '7')
if session4Show
array.push(sessions_arr, '8')

_findSess(_i) =>
arr_size = array.size(sessions_arr) - 1
_index = array.indexof(sessions_arr, _i)
_next = _i

if _index < arr_size


_next := array.get(sessions_arr, _index + 1)
else
_next := array.get(sessions_arr, 0)
_next

_currentSess = noSessionText
_currentSessCol = _color1
var _nextSess = noSessionText
var _nextSessCol = _color1
var _ni = '0'

end_hours = 0
end_minutes = 0
end_seconds = 0

start_hours = 0
start_minutes = 0
start_seconds = 0

// Current Sessions
if(sess7)
_currentSess := frankfurtText
_currentSessCol := frankfurtColor
_ni := _findSess('1')
[_h, _m, _s] = timeTillPeriodEnd(frankfurtTime)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess1)
_currentSess := session1Text
_currentSessCol := session1Color
_ni := _findSess('2')
[_h, _m, _s] = timeTillPeriodEnd(session1Time)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess5)
_currentSess := Horario1Text
_currentSessCol := Horario1Color
_ni := _findSess('3')
[_h, _m, _s] = timeTillPeriodEnd(Horario1Time)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess6)
_currentSess := Horario2Text
_currentSessCol := Horario2Color
_ni := _findSess('4')
[_h, _m, _s] = timeTillPeriodEnd(Horario2Time)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess2)
_currentSess := session2Text
_currentSessCol := session2Color
_ni := _findSess('5')
[_h, _m, _s] = timeTillPeriodEnd(session2Time)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess8)
_currentSess := nyText
_currentSessCol := nyColor
_ni := _findSess('6')
[_h, _m, _s] = timeTillPeriodEnd(nyTime)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess3)
_currentSess := session3Text
_currentSessCol := session3Color
_ni := _findSess('7')
[_h, _m, _s] = timeTillPeriodEnd(session3Time)
end_hours := _h
end_minutes := _m
end_seconds := _s
else if(sess4)
_currentSess := session4Text
_currentSessCol := session4Color
_ni := _findSess('8')
[_h, _m, _s] = timeTillPeriodEnd(session4Time)
end_hours := _h
end_minutes := _m
end_seconds := _s

else
_currentSess := noSessionText
_currentSessCol := _color1
end_hours := 0
end_minutes := 0
end_seconds := 0

// Next Session
if _ni == '1'
_nextSess := frankfurtText
_nextSessCol := frankfurtColor
[_h, _m, _s] = timeTillPeriodEnd(frankfurtTime, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '2'
_nextSess := session1Text
_nextSessCol := session1Color
[_h, _m, _s] = timeTillPeriodEnd(session1Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '3'
_nextSess := Horario1Text
_nextSessCol := Horario1Color
[_h, _m, _s] = timeTillPeriodEnd(Horario1Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '4'
_nextSess := Horario2Text
_nextSessCol := Horario2Color
[_h, _m, _s] = timeTillPeriodEnd(Horario2Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '5'
_nextSess := session2Text
_nextSessCol := session2Color
[_h, _m, _s] = timeTillPeriodEnd(session2Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '6'
_nextSess := nyText
_nextSessCol := nyColor
[_h, _m, _s] = timeTillPeriodEnd(nyTime, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '7'
_nextSess := session3Text
_nextSessCol := session3Color
[_h, _m, _s] = timeTillPeriodEnd(session3Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s
else if _ni == '8'
_nextSess := session4Text
_nextSessCol := session4Color
[_h, _m, _s] = timeTillPeriodEnd(session4Time, 0)
start_hours := _h
start_minutes := _m
start_seconds := _s

else
_nextSess := noSessionText
_nextSessCol := _color1
start_hours := 0
start_minutes := 0
start_seconds := 0

// -------------------- SESSIONS LOGIC --------------------

// -------------------- TABLE --------------------


_position = switch position
"Arriba a la izquierda" => position.top_left
"Arriba a la derecha" => position.top_right
"Abajo a la izquierda" => position.bottom_left
"Abajo a la derecha" => position.bottom_right

end_txt = str.tostring(end_hours) + "h " + str.tostring(end_minutes) + "m"


start_txt = str.tostring(start_hours) + "h " + str.tostring(start_minutes) + "m"

var table _table = table.new(_position, columns = 2, rows = 4, border_width=3)

_vert = alignment == 'Vertical'

if showTable
table.cell(_table, column = 0, row = 0, text = _currentSess,
text_color=color.new(_currentSessCol, 0), bgcolor=color.new(_currentSessCol, 90))
table.cell(_table, column = _vert ? 0 : 1, row = _vert ? 1 : 0, text = end_txt,
text_color=color.new(_currentSessCol, 0))

if showNextSession
table.cell(_table, column = 0, row = 2, text = _nextSess,
text_color=color.new(_nextSessCol, 0), bgcolor=color.new(_nextSessCol, 90))
table.cell(_table, column = _vert ? 0 : 1, row = _vert ? 3 : 2, text =
start_txt, text_color=color.new(_nextSessCol, 0))
// -------------------- TABLE --------------------

// Hagamos Profits 3.0

var GRP3 = "Configuracion de lineas de ASIA"


showLines = input(title='Mostrar lineas: Alto/Bajo de Asia', defval=true,
group=GRP3)
showMiddleLine = input(title='Mostrar 50% de Asia (AML)', defval=true, group=GRP3)
openpriceline = input(title='Open Price Linea (DOP)', defval=true, group=GRP3)
extendLines = input(title='Extender lineas', defval=true, group=GRP3)

rangeTime = input.session(title='Horario de la sesion: Asia', defval='1800-0201',


group=GRP3)
extendTime = input.session(title='Horario de la extension', defval='0300-0401',
tooltip="Horario hasta donde queres extender las lineas", group=GRP3)
i_maxtframe = input.int(15, "Temporalidad maxima", 1, 240, tooltip="Hasta que
temporalidad se ve el indicador en el grafico. Se debe configurar en minutos, 1 hr
= 60 minutos", group=GRP3)

TOOLTIP03 = "Ingresa el tiempo que corresponda segun tu pais (UTC -#)"


hoursOffsetInput3 = input.string('-3', "Tiempo de zona segun tu pais (UTC)",
inline='1', tooltip = TOOLTIP03)
TIMEZONE3 = "GMT"+hoursOffsetInput3

//
var GRP4 = "Estilos de las lineas"
linesWidth = input.int(2, 'Tamaño de las lineas', minval=1, maxval=4, group=GRP4)

boxLineColor = input(#7622ff, 'Alto/bajo de Asia Color', group=GRP4)


user_high_line_style = input.string(title="Alto de Asia: Estilo ", defval="Solido",
options=["Solido", "Lineas", "Puntitos"], group=GRP4)
user_low_line_style = input.string(title="Bajo de Asia: Estilo ", defval="Solido",
options=["Solido", "Lineas", "Puntitos"], group=GRP4)

middleLineColor = input(color.red, '50% de Asia: Color', group=GRP4)


user_middle_line_style = input.string(title="50% de Asia: estilo ",
defval="Puntitos", options=["Solido", "Lineas", "Puntitos"], group=GRP4)

openpricelineColor = input(#00bcd4, 'Day Open Price: Color', group=GRP4)


user_openprice_line_style = input.string(title="Day Open Price: Estilo ",
defval="Puntitos", options=["Solido", "Lineas", "Puntitos"], group=GRP4)

middle_line_style = user_middle_line_style == "Solido" ? line.style_solid :


user_middle_line_style == "Lineas" ? line.style_dashed : user_middle_line_style ==
"Puntitos" ? line.style_dotted : line.style_solid
openprice_line_style = user_openprice_line_style == "Solido" ? line.style_solid :
user_openprice_line_style == "Lineas" ? line.style_dashed :
user_openprice_line_style == "Puntitos" ? line.style_dotted : line.style_solid
high_line_style = user_high_line_style == "Solido" ? line.style_solid :
user_high_line_style == "Lineas" ? line.style_dashed : user_high_line_style ==
"Puntitos" ? line.style_dotted : line.style_solid
low_line_style = user_low_line_style == "Solido" ? line.style_solid :
user_low_line_style == "Lineas" ? line.style_dashed : user_low_line_style ==
"Puntitos" ? line.style_dotted : line.style_solid

inSession = not na(time(timeframe.period, rangeTime, TIMEZONE3))


inExtend = not na(time(timeframe.period, extendTime, TIMEZONE3))

startTime = 0
startTime := inSession and not inSession[1] ? time : startTime[1]

disp1 = timeframe.isintraday and timeframe.multiplier <= i_maxtframe

//Box lines
var line lowHLine = na
var line topHLine = na
var line middleHLine = na
var line openprice1 = na

var box bgBox = na

var low_val = 0.0


var high_val = 0.0
var open_val = 0.0
if inSession and not inSession[1]
low_val := low
high_val := high
open_val := open

// Plot lines
if inSession and disp1
if inSession[1]
line.delete(lowHLine)
line.delete(topHLine)
line.delete(middleHLine)
line.delete(openprice1)
box.delete(bgBox)

if low < low_val


low_val := low
low_val
if high > high_val
high_val := high
high_val
if open == open_val
open_val := open
open_val

//Create Box
//x1, y1, x2, y2

if showLines
lowHLine := line.new(startTime, low_val, time, low_val, xloc=xloc.bar_time,
color=boxLineColor, style=low_line_style, width=linesWidth)
topHLine := line.new(startTime, high_val, time, high_val,
xloc=xloc.bar_time, color=boxLineColor, style=high_line_style, width=linesWidth)

//Create Middle line


if showMiddleLine
middleHLine := line.new(startTime, (high_val + low_val) / 2, time,
(high_val + low_val) / 2, xloc=xloc.bar_time, color=middleLineColor,
style=middle_line_style, width=linesWidth)
//Create Open price linea
if openpriceline
openprice1 := line.new(startTime, open_val, time, open_val,
xloc=xloc.bar_time, color=openpricelineColor, style=openprice_line_style,
width=linesWidth)

else
if inExtend and extendLines and not inSession and timeframe.isintraday
time1 = line.get_x1(lowHLine)
time2 = line.get_x2(lowHLine)
price = line.get_y1(lowHLine)
line.delete(lowHLine)
lowHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=boxLineColor, style=low_line_style, width=linesWidth)

time1 := line.get_x1(topHLine)
time2 := line.get_x2(topHLine)
price := line.get_y1(topHLine)
line.delete(topHLine)
topHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=boxLineColor, style=high_line_style, width=linesWidth)

time1 := line.get_x1(openprice1)
time2 := line.get_x2(openprice1)
price := line.get_y1(openprice1)
line.delete(openprice1)
openprice1 := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=openpricelineColor, style=openprice_line_style, width=linesWidth)

time1 := line.get_x1(middleHLine)
time2 := line.get_x2(middleHLine)
price := line.get_y1(middleHLine)
line.delete(middleHLine)
middleHLine := line.new(time1, price, time, price, xloc=xloc.bar_time,
color=middleLineColor, style=middle_line_style, width=linesWidth)
middleHLine

También podría gustarte