Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Hagamos Profit
Hagamos Profit
// 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
//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
// 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
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)
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 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
//BIG BOXES
//TABLA DE SESIONES
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 --------------------
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
_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
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 --------------------
//
var GRP4 = "Estilos de las lineas"
linesWidth = input.int(2, 'Tamaño de las lineas', minval=1, maxval=4, group=GRP4)
startTime = 0
startTime := inSession and not inSession[1] ? time : startTime[1]
//Box lines
var line lowHLine = na
var line topHLine = na
var line middleHLine = na
var line openprice1 = na
// Plot lines
if inSession and disp1
if inSession[1]
line.delete(lowHLine)
line.delete(topHLine)
line.delete(middleHLine)
line.delete(openprice1)
box.delete(bgBox)
//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)
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