OPEN-SOURCE SCRIPT
grinpa

pedro
pedro02599
En línea
Canal de texto
No Somos Liquidez:【📖】biblioteca
Buscar No Somos Liquidez
Hilos
Hermit.exe
Hermit.exe
hace >30 días
Notion Trade Tracker
Herramientas
0
Hermit.exe
Hermit.exe
hace >30 días
Notion Journal
Herramientas
0
9
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Indicador Judas Swing
SMC
Herramientas
0
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Indicador TV Samurái V1
SMC
Herramientas
0
2
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Hábitos Atómicos
Psicologia
0
Hermit.exe
Hermit.exe
22 de septiembre de 2024
El trading como negocio
Psicologia
0
Hilo
Hilo:Indicador TV Samurái V1
Chat de Indicador TV Samurái V1
Indicador TV Samurái V1
SMC
22 de septiembre de 2024
Hermit.exe
NSL
Senior Mod
AO
Autor(a) original — 22/09/2024 16:06domingo, 22 de septiembre de 2024 16:06
vip
Primero agradecer al compañero Romulo por su generosidad y compartir el indicador para la comunidad, todos los créditos de creación para el
El indicador tal como su nombre indica sirve para marcar el horario de operativa y elementos de la estrategia Samurái V1. Este indicador no esta publico en TV por lo que tendrán que añadirlo de manera manual a través de un script a TradingView, cabe recalcar que no es nada complicado, para hacerlo aquí les dejamos un pequeño tutorial:
youtube.com/watch?v=WfyKUCCd874&t=238s
Indicaciones para agregarlo de manera manual:
Entramos a TV y buscamos "editor de Pine" en la parte inferior izquierda de la pantalla.,
Le damos click y aparecerá un nuevo menú,
Posteriormente eliminamos todo lo que este dentro del menú,
Ahora copiamos todo el texto del archivo del indicador y lo pegamos en el menú de TV,
Finalmente le damos a "añadir al grafico" que se encuentra en la parte derecha de la misma barra donde estaba "editor de pine".,
// This work is by modifiec for me.
// © ARAYA
//version=5
indicator('SAMURAI v1 [NSL]', overlay = true, max_lines_count = 500, max_labels_count = 100)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
group_ln = 'London Time Settings'
lnSummerTime = 0
group_m07 = 'SAMURAI INVIERNO/ New York 07:00 AM 07:10 '
m07000710 = input.bool(false, '07:00 AM 07:10', group = group_m07)
m07_top = input.bool(true, 'Top Line', inline = 'mc07', group = group_m07)
m07_mid = input.bool(true, 'Mid Line', inline = 'mc07', group = group_m07)
m07_bot = input.bool(true, 'Bottom Line', inline = 'mc07', group = group_m07)
m07_ext = input.bool(true, 'Extending Lines', inline = 'mc07', group = group_m07)
group_ny = 'New York Time Settings'
nySummerTime = input.bool(true , 'New York Daylight Saving Time (DST)', group = group_ny, tooltip = 'New York : Daylight Saving Time (DST)\n - DST Start : Second Sunday in March at 2:00\n - DST End : First Sunday in November at 2:00')
group_m08 = ' SAMURAI 08:00 PM 08:10 '
m08000810 = input.bool(true , '08:00 PM 08:10', group = group_m08)
m08_top = input.bool(true, 'Top Line', inline = 'mc08', group = group_m08)
m08_mid = input.bool(true, 'Mid Line', inline = 'mc08', group = group_m08)
m08_bot = input.bool(true, 'Bottom Line', inline = 'mc08', group = group_m08)
m08_ext = input.bool(true, 'Extending Lines', inline = 'mc08', group = group_m08)
group_c = 'ESTRUCTURA'
pLen = 0
pLoc = label.style_none
aColor = input.color(color.gray, ' Color del Rango', group = group_c)
mColor = aColor
eColor = aColor
mcText = input.string('Small', "Tamaño del Texto", options=['Tiny', 'Small', 'Normal', 'None'])
mcSize = switch mcText
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
=> size.tiny
mcAlert = 0
mcAlertM = 0
//-----------------------------------------------------------------------------}
//UDT's
//-----------------------------------------------------------------------------{
type bar
float o = open
float h = high
float l = low
float c = close
int t = time
type macro
int t // unix time
int x2 // end bar_index
int len // macro length
float o // macro open price value
float top // macro top price value
float bottom // macro bottom price value
float mid // macro mid price value
float co // macro close open price value
float ch // macro close high price value
float cl // macro close low price value
float cc // macro close close price value
line lnh // macro top line
line lnhe // macro top line - extended
line lnl // macro bottom line
line lnle // macro bottom line - extended
line lnm // macro mid line
line lnme // macro mid line - extended
line lnf // next macro start
linefill lf // macro box (linefill)
label lb // macro label
string xloc = xloc.bar_index
color color = chart.fg_color
color nocolor = chart.bg_color
type pivotPoint
int ht // pivot high unix time
int lt // pivot low unix time
float h // last pivot high price value
float h1 // previous pivot high price value
float l // last pivot low price value
float l1 // previous pivot low price value
//-----------------------------------------------------------------------------}
//Methods / Functions
//-----------------------------------------------------------------------------{
// Function updates horizontal line's y1 and y2 value
// param _ln (line) line to be updated
// param _y (float) The new value
// Returns none
method set_y(line _ln, float _y) => _ln.set_y1(_y), _ln.set_y2(_y)
... (413 líneas restantes)
Contraer
Contraer (513 líneas)
Ver todo el archivo
SAMURAI v1.txt
SAMURAI v1.txt (23 KB)
23 KB
SAMURAI v1.txt (23 KB)
Descargar SAMURAI v1.txt (23 KB)Cambiar de idioma
Reenviar
Más
2
Seguir
Añade esta publicación a tu lista de canales y recibe notificaciones sobre ella.
Copiar enlace
No tienes permiso para enviar mensajes en este canal.
// This work is by modifiec for me.
// © ARAYA
//version=5
indicator('SAMURAI v1 [NSL]', overlay = true, max_lines_count = 500, max_labels_count = 100)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
group_ln = 'London Time Settings'
lnSummerTime = 0
group_m07 = 'SAMURAI INVIERNO/ New York 07:00 AM 07:10 '
m07000710 = input.bool(false, '07:00 AM 07:10', group = group_m07)
m07_top = input.bool(true, 'Top Line', inline = 'mc07', group = group_m07)
m07_mid = input.bool(true, 'Mid Line', inline = 'mc07', group = group_m07)
m07_bot = input.bool(true, 'Bottom Line', inline = 'mc07', group = group_m07)
m07_ext = input.bool(true, 'Extending Lines', inline = 'mc07', group = group_m07)
group_ny = 'New York Time Settings'
nySummerTime = input.bool(true , 'New York Daylight Saving Time (DST)', group = group_ny, tooltip = 'New York : Daylight Saving Time (DST)\n - DST Start : Second Sunday in March at 2:00\n - DST End : First Sunday in November at 2:00')
group_m08 = ' SAMURAI 08:00 PM 08:10 '
m08000810 = input.bool(true , '08:00 PM 08:10', group = group_m08)
m08_top = input.bool(true, 'Top Line', inline = 'mc08', group = group_m08)
m08_mid = input.bool(true, 'Mid Line', inline = 'mc08', group = group_m08)
m08_bot = input.bool(true, 'Bottom Line', inline = 'mc08', group = group_m08)
m08_ext = input.bool(true, 'Extending Lines', inline = 'mc08', group = group_m08)
group_c = 'ESTRUCTURA'
pLen = 0
pLoc = label.style_none
aColor = input.color(color.gray, ' Color del Rango', group = group_c)
mColor = aColor
eColor = aColor
mcText = input.string('Small', "Tamaño del Texto", options=['Tiny', 'Small', 'Normal', 'None'])
mcSize = switch mcText
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
=> size.tiny
mcAlert = 0
mcAlertM = 0
//-----------------------------------------------------------------------------}
//UDT's
//-----------------------------------------------------------------------------{
type bar
float o = open
float h = high
float l = low
float c = close
int t = time
type macro
int t // unix time
int x2 // end bar_index
int len // macro length
float o // macro open price value
float top // macro top price value
float bottom // macro bottom price value
float mid // macro mid price value
float co // macro close open price value
float ch // macro close high price value
float cl // macro close low price value
float cc // macro close close price value
line lnh // macro top line
line lnhe // macro top line - extended
line lnl // macro bottom line
line lnle // macro bottom line - extended
line lnm // macro mid line
line lnme // macro mid line - extended
line lnf // next macro start
linefill lf // macro box (linefill)
label lb // macro label
string xloc = xloc.bar_index
color color = chart.fg_color
color nocolor = chart.bg_color
type pivotPoint
int ht // pivot high unix time
int lt // pivot low unix time
float h // last pivot high price value
float h1 // previous pivot high price value
float l // last pivot low price value
float l1 // previous pivot low price value
//-----------------------------------------------------------------------------}
//Methods / Functions
//-----------------------------------------------------------------------------{
// Function updates horizontal line's y1 and y2 value
// param _ln (line) line to be updated
// param _y (float) The new value
// Returns none
method set_y(line _ln, float _y) => _ln.set_y1(_y), _ln.set_y2(_y)
// Function get the current bar's unix time, hour and minute
// param _utc (string) utc and major city in the form of '(UTC-05:00) NEW YORK'
// param _dst (bool) daylight saving time
// param _utcTimeOffset (array) array storing the utc info
// param _utcCity (array) array storing the major city info
// param _inAd (int) ofsset value in minutes
// param _tf_m (int) timeframe multiplier
// Returns A tuple containing (int) index, (int) hour and (int) minute
method f_getBarTime(string _utc, _dst, _utcTimeOffset, _utcCity, _inAd, _tf_m) =>
utcTime = (array.get(_utcTimeOffset, array.indexof(_utcCity, _utc)) + (_dst ? 1 : 0)) * 3600000 + _inAd * 60000 + time
h = math.floor(utcTime / 3600000) % 24
m = math.floor(utcTime / 60000) % 60
int idx = 0
if _tf_m == 3
if m == 48
m := m + 2
idx := 2
else if m == 9
m := m + 1
idx := 1
//else if m == 12 or m == 42
// idx := 0
else if _tf_m == 5
if (m == 0 and h == 9) or (m == 30 and h == 7)
m := m + 3
idx := 3
[idx, h, m]
// Function calculate and get customized pivot points high low and time values
// param _len (int) length for the pivot points high low calculation
// param _loc (string) if set to 'wick' highest/lowest values of the detected pivot points high low will be calculated
// if set to 'Body' the highest/lowest values of the candel bodies will be returend as pivot points high low
// Returns A tuple containing (float) ph - pivot high, (float) pl - pivot low, (int) pht - pivot high unix time (int) plt - pivot low unix time
method f_getPivotPoint(int _len, _loc) =>
ph = ta.pivothigh(_len, _len)
if ph and _loc == 'Body'
ph := math.max(open[_len], close[_len])
pl = ta.pivotlow (_len, _len)
if pl and _loc == 'Body'
pl := math.min(open[_len], close[_len])
pht = ph ? time[_len] : na
plt = pl ? time[_len] : na
[ph, pl, pht, plt]
//-----------------------------------------------------------------------------}
//Main variables
//-----------------------------------------------------------------------------{
tf_m = timeframe.multiplier
bi = bar_index
var a_majorCity = array.new_string(), var a_utcTimeOffset = array.new_float(), var a_utcCity = array.new_string()
if barstate.isfirst
array.push(a_majorCity, 'NEW YORK'), array.push(a_utcTimeOffset, -5), array.push(a_utcCity, '(UTC-05:00) NEW YORK')
array.push(a_majorCity, 'LONDON' ), array.push(a_utcTimeOffset, 0 ), array.push(a_utcCity, '(UTC+00:00) LONDON' )
// Lower TF bar UDT array
ltfB = request.security_lower_tf(syminfo.tickerid, '1', bar.new())
// Lower TF pivotPoint UDT arrays
var pivotPoint p = pivotPoint.new()
[a_pH, a_pL, a_pHt, a_pLt] = request.security_lower_tf(syminfo.tickerid, '1', f_getPivotPoint(pLen, pLoc))
if not na(array.min(a_pL))
p.l := array.min(a_pL)
p.lt := array.min(a_pLt)
if not na(array.max(a_pH))
p.h := array.max(a_pH)
p.ht := array.max(a_pHt)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//units and multipliers for versatility across asset classes
pUnits = syminfo.type== 'index' or syminfo.type == 'futures'? ' $':
syminfo.type=='forex'?' pips':na
mult= str.tonumber(timeframe.period)<=5? 1: str.tonumber(timeframe.period)<=240? 60: timeframe.isdwm? 1440:na
pMult = syminfo.type== 'index' or syminfo.type == 'futures'? 1:
syminfo.type=='forex'? 100:1
tUnits = mult==1? ' mins': mult==60? ' hours':mult==1440? ' days':na
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------}
//Detect ICT macros
//-----------------------------------------------------------------------------{
var macro mc = macro.new()
// Function main function : detects macros, draws nad controls macro components and classifies macros
// param _m (bool) enable/disable specific macro
// param _msh (int) macro start hour
// param _msm (int) macro start minute
// param _mh (bool) macro top line control option
// param _ml (bool) macro bottom line control option
// param _mm (bool) macro middle line control option
// param _me (bool) macro extended lines control option
// param _mt (bool) macro label text value
//
// param _utc (string) utc and major city in the form of '(UTC-05:00) NEW YORK'
// param _dst (bool) daylight saving time
// param _tf_m (int) timeframe multiplier
// param _alert (bool) next macro time start location, displays in _alertM minutes
// param _alertM (int) alert in _alertM minutes
// Returns macro UDT components created
processMacro(_m, _msh, _msm, _mh, _ml, _mm, _me, _mt, _utc, _dst, _tf_m, _alert, _alertM) =>
if _m
[_, ha, ma] = f_getBarTime(_utc, _dst, a_utcTimeOffset, a_utcCity, _alertM, _tf_m)
if ha == _msh and ma == _msm
alert(_mt + ' macro will be in play in ' + str.tostring(_alertM) + ' minutes for instrument ' + syminfo.ticker)
if _alert
mc.lnf := line.new(time + _alertM * 60000 , high, time + _alertM * 60000, low, xloc.bar_time, extend.both, mc.color, line.style_solid , 1)
[idx, h, m] = f_getBarTime(_utc, _dst, a_utcTimeOffset, a_utcCity, 0, _tf_m)
if h == 08 or h == 07 or h == 1 or h == 3 or h == 5
if m == 0
mc.len := 10
else
mc.len := 180
if h == 11
if m == 0
mc.len := 10
else
mc.len := 300
if h == _msh and m == _msm
mc.lnf.delete()
if ltfB.size() > idx
if not na(ltfB.get(idx).h)
mc.t := ltfB.get(idx).t
mc.o := ltfB.get(idx).o
mc.top := ltfB.get(idx).h
mc.bottom := ltfB.get(idx).l
if idx == 0
mc.x2 := bi + math.round(mc.len / _tf_m)
else
mc.x2 := bi + math.round(mc.len / _tf_m) + 1
mc.lnh := line.new(bi, mc.top, int(mc.x2), mc.top, color = _mh ? mc.color : mc.nocolor, style = line.style_solid , width = 2)
mc.lnhe := line.new(int(mc.x2), mc.top, int(mc.x2), mc.top, color = _me ? _mh ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 2)
mc.lnl := line.new(bi, mc.bottom, int(mc.x2), mc.bottom, color =_ml ? mc.color : mc.nocolor, style = line.style_solid , width = 2)
mc.lnle := line.new(int(mc.x2), mc.bottom, int(mc.x2), mc.bottom, color = _me ? _ml ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 2)
mc.lnm := line.new(bi, math.avg(mc.top, mc.bottom), int(mc.x2), math.avg(mc.top, mc.bottom), color = _mm ? mc.color : mc.nocolor, style = line.style_dotted, width = 1)
mc.lnme := line.new(bi, math.avg(mc.top, mc.bottom), int(mc.x2), math.avg(mc.top, mc.bottom), color = _me ? _mm ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 1)
mc.lf := linefill.new(mc.lnh, mc.lnl, color.new(color.gray, 100))
mc.lb := label.new(bi + int(mc.len / _tf_m / 2), mc.top, mcText != 'None' ? 'SAMURAI\n' + _mt : '', xloc.bar_index, yloc.price, #00000000, label.style_label_down, chart.fg_color, mcSize, text.align_left, '')
p.l1 := p.l
p.h1 := p.h
else if bi < int(mc.x2) and time >= mc.t
mc.top := math.max(high, mc.lnh.get_y1())
mc.lnh.set_y(mc.top), mc.lnhe.set_y(mc.top)
mc.bottom := math.min(low , mc.lnl.get_y1())
mc.lnl.set_y(mc.bottom), mc.lnle.set_y(mc.bottom)
mc.mid := math.avg(math.max(high, mc.lnh.get_y1()), math.min(low , mc.lnl.get_y1()))
mc.lnm.set_y(mc.mid), mc.lnme.set_y(mc.mid)
mc.lb.set_y(math.max(high, mc.lb.get_y()))
if not na(array.min(a_pL)) and p.lt < mc.t
p.l1 := array.min(a_pL)
if not na(array.max(a_pH)) and p.ht < mc.t
p.h1 := array.max(a_pH)
else if bi == int(mc.x2)
if ltfB.size() > idx
if not na(ltfB.get(idx).c)
mc.co := ltfB.get(idx).o
mc.ch := ltfB.get(idx).h
mc.cl := ltfB.get(idx).l
mc.cc := ltfB.get(idx).c
mc.top := math.max(mc.ch, mc.lnh.get_y1())
mc.lnh.set_y(mc.top), mc.lnhe.set_y(mc.top)
mc.bottom := math.min(mc.cl , mc.lnl.get_y1())
mc.lnl.set_y(mc.bottom), mc.lnle.set_y(mc.bottom)
mc.mid := math.avg(math.max(mc.top, mc.lnh.get_y1()), math.min(mc.bottom , mc.lnl.get_y1()))
mc.lnm.set_y(mc.mid), mc.lnme.set_y(mc.mid)
mc.lb.set_y(math.max(mc.top, mc.lb.get_y()))
if not na(array.min(a_pL)) and p.lt < mc.t
p.l1 := array.min(a_pL)
if not na(array.max(a_pH)) and p.ht < mc.t
p.h1 := array.max(a_pH)
else if mc.t == mc.t[1]
mc.lnhe.set_x2(bi), mc.lnle.set_x2(bi), mc.lnme.set_x2(bi)
if bi == int(mc.x2) + 1 and not str.contains(mc.lb.get_text(), 'on NSL')
mc.lb.set_tooltip('mc open : '+ str.tostring(mc.o , format.mintick) +
'\nmc close : ' + str.tostring(mc.cc , format.mintick) +
'\nmc top : ' + str.tostring(mc.top , format.mintick) +
'\nmc mid : ' + str.tostring(mc.mid , format.mintick) +
'\nmc bottom : ' + str.tostring(mc.bottom, format.mintick) )
if mc.bottom < p.l1 and mc.top > p.h1
if (mc.o < math.avg(mc.bottom, mc.mid) and mc.cc > math.avg(mc.top, mc.mid)) or (mc.o > math.avg(mc.top, mc.mid) and mc.cc < math.avg(mc.bottom, mc.mid))
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(mColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else if mc.bottom < p.l1 or mc.top > p.h1
if (mc.co > mc.mid and mc.cc < mc.mid) or (mc.co < mc.mid and mc.cc > mc.mid) or (mc.o < mc.mid and mc.cc < mc.mid) or (mc.o > mc.mid and mc.cc > mc.mid) // pL > pmcPL or pmcPH < pH
mc.lf.set_color(color.new(aColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
if p.l == p.l1 and p.h == p.h1 and (mc.o < math.avg(mc.bottom, mc.mid) and mc.cc > math.avg(mc.top, mc.mid)) or (mc.o > math.avg(mc.top, mc.mid) and mc.cc < math.avg(mc.bottom, mc.mid))
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(aColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
//-----------------------------------------------------------------------------}
//Process macros
//-----------------------------------------------------------------------------{
if tf_m <= 15
processMacro(m07000710, 11, 00, m07_top, m07_bot, m07_mid, m07_ext, '07:00 AM - 07:10', '(UTC+00:00) LONDON' , lnSummerTime, tf_m, mcAlert, mcAlertM)
processMacro(m08000810, 08, 00, m08_top, m08_bot, m08_mid, m08_ext, '08:00 AM - 08:10', '(UTC-05:00) NEW YORK', nySummerTime, tf_m, mcAlert, mcAlertM)
else
var table note = table.new(position.bottom_right, 1, 1)
if barstate.islast
table.cell(note, 0, 0, 'ICT Macros are supported on:\n 1 min, 3, 5 mins and 15 mins charts\n\n', text_size=size.small, text_color=chart.fg_color)
//-----------------------------------------------------------------------------}
//OPEN RANGO DE ESTRATEGIA
// INPUTS
i_time = input.session ('0800-0801:1234567', "OPEN SAMURAI", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz = input ("GMT-4", "Timezone")
i_vline = input.bool (true, "VLine", inline="in1")
i_vcol = input.color (#006eff, "", inline="in1")
i_txtcol = input.color (#006eff, " Text color", inline="in1")
i_vstyle = input.string ("Solid", "Style", options=["Solid", "Dotted", "Dashed"])
i_hline = label.style_none
i_linecol = label.style_none
i_linestyle = label.style_none
i_ex = label.style_none
i_ex2 = label.style_none
i_ex3 = label.style_none
// MISC
nymidz = time ("1", i_time, i_tz)
linestyle = i_linestyle == "Solid" ? line.style_solid : i_linestyle == "Dotted" ? line.style_dotted : line.style_dashed
vstyle = i_vstyle == "Solid" ? line.style_solid : i_vstyle == "Dotted" ? line.style_dotted : line.style_dashed
ex = i_ex == "1 Day" ? extend.none : i_ex == "2 Days" ? extend.none : i_ex == "Right" ? extend.right : extend.both
htime = i_ex == "2 Days" ? 172800000 : 86400000
hourtime = label.style_none
// CALC
var openprice = 0.0
if nymidz
if not nymidz[1]
openprice := open
else
openprice := math.max(open, openprice)
// OBJECTS
var label lb = na
if openprice != openprice[1]
var line lne = na
line.set_x2(lne, nymidz)
line.set_extend(lne, extend.none)
if i_vline and nymidz == nymidz
vl1 = line.new(nymidz, high, nymidz, low, xloc.bar_time, extend.both, i_vcol, vstyle, 1)
if line.get_y1(vl1) == line.get_y2(vl1)
line.delete(vl1)
///////////////////////////////////////////////////////////////////////////////////
//CLOSE RANGO DE ESTRATEGIA
// INPUTS
i_time0 = input.session ('0810-0811:1234567', "CLOSE SAMURAI", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz0 = i_tz
i_vline0 = i_vline
i_vcol0 = i_vcol
i_txtcol0 = i_txtcol
i_vstyle0 = i_vstyle
i_hline0 = label.style_none
i_linecol0 = label.style_none
i_linestyle0 = label.style_none
i_ex0 = label.style_none
i_ex20 = label.style_none
i_ex30 = label.style_none
// MISC
nymid0 = time ("1", i_time0, i_tz0)
linestyle0 = i_linestyle0 == "Solid" ? line.style_solid : i_linestyle0 == "Dotted" ? line.style_dotted : line.style_dashed
vstyle0 = i_vstyle0 == "Solid" ? line.style_solid : i_vstyle0 == "Dotted" ? line.style_dotted : line.style_dashed
ex0 = i_ex0 == "1 Day" ? extend.none : i_ex0 == "2 Days" ? extend.none : i_ex0 == "Right" ? extend.right : extend.both
htime0 = i_ex0 == "2 Days" ? 172800000 : 86400000
hourtime0 = label.style_none
// CALC
var openprice0 = 0.0
if nymid0
if not nymid0[1]
openprice0 := open
else
openprice0 := math.max(open, openprice0)
// OBJECTS
var label lb0 = na
if openprice0 != openprice0[1]
var line lne0 = na
line.set_x2(lne0, nymid0)
line.set_extend(lne0, extend.none)
if i_vline0 and nymid0 == nymid0
vl10 = line.new(nymid0, high, nymid0, low, xloc.bar_time, extend.both, i_vcol0, vstyle0, 1)
if line.get_y1(vl10) == line.get_y2(vl10)
line.delete(vl10)
///////////////////////////////////////////////////////////////////////////////////////////////
//CLOSE MAX 8:45
// INPUTS
i_time1 = input.session ('0845-0846:1234567', "END", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz1 = i_tz
i_vline1 = i_vline
i_vcol1 = i_vcol
i_txtcol1 = i_txtcol
i_vstyle1 = i_vstyle
i_hline1 = label.style_none
i_linecol1 = label.style_none
i_linestyle1 = label.style_none
i_ex1 = label.style_none
i_ex21 = label.style_none
i_ex31 = label.style_none
// MISC
nymid1 = time ("1", i_time1, i_tz1)
linestyle1 = i_linestyle1 == "Solid" ? line.style_solid : i_linestyle1 == "Dotted" ? line.style_dotted : line.style_dashed
vstyle1 = i_vstyle1 == "Solid" ? line.style_solid : i_vstyle1 == "Dotted" ? line.style_dotted : line.style_dashed
ex1 = i_ex1 == "1 Day" ? extend.none : i_ex1 == "2 Days" ? extend.none : i_ex1 == "Right" ? extend.right : extend.both
htime1 = i_ex1 == "2 Days" ? 172800000 : 86400000
hourtime1 = label.style_none
// CALC
var openprice1 = 0.0
if nymid1
if not nymid1[1]
openprice1 := open
else
openprice1 := math.max(open, openprice1)
// OBJECTS
var label lb1 = na
if openprice1 != openprice1[1]
var line lne1 = na
line.set_x2(lne1, nymid1)
line.set_extend(lne1, extend.none)
if i_vline1 and nymid1 == nymid1
vl11 = line.new(nymid1, high, nymid1, low, xloc.bar_time, extend.both, i_vcol1, vstyle1, 1)
if line.get_y1(vl11) == line.get_y2(vl11)
line.delete(vl11)
// EN
pedro02599
En línea
Canal de texto
No Somos Liquidez:【📖】biblioteca
Buscar No Somos Liquidez
Hilos
Hermit.exe
Hermit.exe
hace >30 días
Notion Trade Tracker
Herramientas
0
Hermit.exe
Hermit.exe
hace >30 días
Notion Journal
Herramientas
0
9
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Indicador Judas Swing
SMC
Herramientas
0
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Indicador TV Samurái V1
SMC
Herramientas
0
2
Hermit.exe
Hermit.exe
22 de septiembre de 2024
Hábitos Atómicos
Psicologia
0
Hermit.exe
Hermit.exe
22 de septiembre de 2024
El trading como negocio
Psicologia
0
Hilo
Hilo:Indicador TV Samurái V1
Chat de Indicador TV Samurái V1
Indicador TV Samurái V1
SMC
22 de septiembre de 2024
Hermit.exe
NSL
Senior Mod
AO
Autor(a) original — 22/09/2024 16:06domingo, 22 de septiembre de 2024 16:06
vip
Primero agradecer al compañero Romulo por su generosidad y compartir el indicador para la comunidad, todos los créditos de creación para el
El indicador tal como su nombre indica sirve para marcar el horario de operativa y elementos de la estrategia Samurái V1. Este indicador no esta publico en TV por lo que tendrán que añadirlo de manera manual a través de un script a TradingView, cabe recalcar que no es nada complicado, para hacerlo aquí les dejamos un pequeño tutorial:
youtube.com/watch?v=WfyKUCCd874&t=238s
Indicaciones para agregarlo de manera manual:
Entramos a TV y buscamos "editor de Pine" en la parte inferior izquierda de la pantalla.,
Le damos click y aparecerá un nuevo menú,
Posteriormente eliminamos todo lo que este dentro del menú,
Ahora copiamos todo el texto del archivo del indicador y lo pegamos en el menú de TV,
Finalmente le damos a "añadir al grafico" que se encuentra en la parte derecha de la misma barra donde estaba "editor de pine".,
// This work is by modifiec for me.
// © ARAYA
//version=5
indicator('SAMURAI v1 [NSL]', overlay = true, max_lines_count = 500, max_labels_count = 100)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
group_ln = 'London Time Settings'
lnSummerTime = 0
group_m07 = 'SAMURAI INVIERNO/ New York 07:00 AM 07:10 '
m07000710 = input.bool(false, '07:00 AM 07:10', group = group_m07)
m07_top = input.bool(true, 'Top Line', inline = 'mc07', group = group_m07)
m07_mid = input.bool(true, 'Mid Line', inline = 'mc07', group = group_m07)
m07_bot = input.bool(true, 'Bottom Line', inline = 'mc07', group = group_m07)
m07_ext = input.bool(true, 'Extending Lines', inline = 'mc07', group = group_m07)
group_ny = 'New York Time Settings'
nySummerTime = input.bool(true , 'New York Daylight Saving Time (DST)', group = group_ny, tooltip = 'New York : Daylight Saving Time (DST)\n - DST Start : Second Sunday in March at 2:00\n - DST End : First Sunday in November at 2:00')
group_m08 = ' SAMURAI 08:00 PM 08:10 '
m08000810 = input.bool(true , '08:00 PM 08:10', group = group_m08)
m08_top = input.bool(true, 'Top Line', inline = 'mc08', group = group_m08)
m08_mid = input.bool(true, 'Mid Line', inline = 'mc08', group = group_m08)
m08_bot = input.bool(true, 'Bottom Line', inline = 'mc08', group = group_m08)
m08_ext = input.bool(true, 'Extending Lines', inline = 'mc08', group = group_m08)
group_c = 'ESTRUCTURA'
pLen = 0
pLoc = label.style_none
aColor = input.color(color.gray, ' Color del Rango', group = group_c)
mColor = aColor
eColor = aColor
mcText = input.string('Small', "Tamaño del Texto", options=['Tiny', 'Small', 'Normal', 'None'])
mcSize = switch mcText
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
=> size.tiny
mcAlert = 0
mcAlertM = 0
//-----------------------------------------------------------------------------}
//UDT's
//-----------------------------------------------------------------------------{
type bar
float o = open
float h = high
float l = low
float c = close
int t = time
type macro
int t // unix time
int x2 // end bar_index
int len // macro length
float o // macro open price value
float top // macro top price value
float bottom // macro bottom price value
float mid // macro mid price value
float co // macro close open price value
float ch // macro close high price value
float cl // macro close low price value
float cc // macro close close price value
line lnh // macro top line
line lnhe // macro top line - extended
line lnl // macro bottom line
line lnle // macro bottom line - extended
line lnm // macro mid line
line lnme // macro mid line - extended
line lnf // next macro start
linefill lf // macro box (linefill)
label lb // macro label
string xloc = xloc.bar_index
color color = chart.fg_color
color nocolor = chart.bg_color
type pivotPoint
int ht // pivot high unix time
int lt // pivot low unix time
float h // last pivot high price value
float h1 // previous pivot high price value
float l // last pivot low price value
float l1 // previous pivot low price value
//-----------------------------------------------------------------------------}
//Methods / Functions
//-----------------------------------------------------------------------------{
// Function updates horizontal line's y1 and y2 value
// param _ln (line) line to be updated
// param _y (float) The new value
// Returns none
method set_y(line _ln, float _y) => _ln.set_y1(_y), _ln.set_y2(_y)
... (413 líneas restantes)
Contraer
Contraer (513 líneas)
Ver todo el archivo
SAMURAI v1.txt
SAMURAI v1.txt (23 KB)
23 KB
SAMURAI v1.txt (23 KB)
Descargar SAMURAI v1.txt (23 KB)Cambiar de idioma
Reenviar
Más
2
Seguir
Añade esta publicación a tu lista de canales y recibe notificaciones sobre ella.
Copiar enlace
No tienes permiso para enviar mensajes en este canal.
// This work is by modifiec for me.
// © ARAYA
//version=5
indicator('SAMURAI v1 [NSL]', overlay = true, max_lines_count = 500, max_labels_count = 100)
//------------------------------------------------------------------------------
//Settings
//-----------------------------------------------------------------------------{
group_ln = 'London Time Settings'
lnSummerTime = 0
group_m07 = 'SAMURAI INVIERNO/ New York 07:00 AM 07:10 '
m07000710 = input.bool(false, '07:00 AM 07:10', group = group_m07)
m07_top = input.bool(true, 'Top Line', inline = 'mc07', group = group_m07)
m07_mid = input.bool(true, 'Mid Line', inline = 'mc07', group = group_m07)
m07_bot = input.bool(true, 'Bottom Line', inline = 'mc07', group = group_m07)
m07_ext = input.bool(true, 'Extending Lines', inline = 'mc07', group = group_m07)
group_ny = 'New York Time Settings'
nySummerTime = input.bool(true , 'New York Daylight Saving Time (DST)', group = group_ny, tooltip = 'New York : Daylight Saving Time (DST)\n - DST Start : Second Sunday in March at 2:00\n - DST End : First Sunday in November at 2:00')
group_m08 = ' SAMURAI 08:00 PM 08:10 '
m08000810 = input.bool(true , '08:00 PM 08:10', group = group_m08)
m08_top = input.bool(true, 'Top Line', inline = 'mc08', group = group_m08)
m08_mid = input.bool(true, 'Mid Line', inline = 'mc08', group = group_m08)
m08_bot = input.bool(true, 'Bottom Line', inline = 'mc08', group = group_m08)
m08_ext = input.bool(true, 'Extending Lines', inline = 'mc08', group = group_m08)
group_c = 'ESTRUCTURA'
pLen = 0
pLoc = label.style_none
aColor = input.color(color.gray, ' Color del Rango', group = group_c)
mColor = aColor
eColor = aColor
mcText = input.string('Small', "Tamaño del Texto", options=['Tiny', 'Small', 'Normal', 'None'])
mcSize = switch mcText
'Tiny' => size.tiny
'Small' => size.small
'Normal' => size.normal
=> size.tiny
mcAlert = 0
mcAlertM = 0
//-----------------------------------------------------------------------------}
//UDT's
//-----------------------------------------------------------------------------{
type bar
float o = open
float h = high
float l = low
float c = close
int t = time
type macro
int t // unix time
int x2 // end bar_index
int len // macro length
float o // macro open price value
float top // macro top price value
float bottom // macro bottom price value
float mid // macro mid price value
float co // macro close open price value
float ch // macro close high price value
float cl // macro close low price value
float cc // macro close close price value
line lnh // macro top line
line lnhe // macro top line - extended
line lnl // macro bottom line
line lnle // macro bottom line - extended
line lnm // macro mid line
line lnme // macro mid line - extended
line lnf // next macro start
linefill lf // macro box (linefill)
label lb // macro label
string xloc = xloc.bar_index
color color = chart.fg_color
color nocolor = chart.bg_color
type pivotPoint
int ht // pivot high unix time
int lt // pivot low unix time
float h // last pivot high price value
float h1 // previous pivot high price value
float l // last pivot low price value
float l1 // previous pivot low price value
//-----------------------------------------------------------------------------}
//Methods / Functions
//-----------------------------------------------------------------------------{
// Function updates horizontal line's y1 and y2 value
// param _ln (line) line to be updated
// param _y (float) The new value
// Returns none
method set_y(line _ln, float _y) => _ln.set_y1(_y), _ln.set_y2(_y)
// Function get the current bar's unix time, hour and minute
// param _utc (string) utc and major city in the form of '(UTC-05:00) NEW YORK'
// param _dst (bool) daylight saving time
// param _utcTimeOffset (array) array storing the utc info
// param _utcCity (array) array storing the major city info
// param _inAd (int) ofsset value in minutes
// param _tf_m (int) timeframe multiplier
// Returns A tuple containing (int) index, (int) hour and (int) minute
method f_getBarTime(string _utc, _dst, _utcTimeOffset, _utcCity, _inAd, _tf_m) =>
utcTime = (array.get(_utcTimeOffset, array.indexof(_utcCity, _utc)) + (_dst ? 1 : 0)) * 3600000 + _inAd * 60000 + time
h = math.floor(utcTime / 3600000) % 24
m = math.floor(utcTime / 60000) % 60
int idx = 0
if _tf_m == 3
if m == 48
m := m + 2
idx := 2
else if m == 9
m := m + 1
idx := 1
//else if m == 12 or m == 42
// idx := 0
else if _tf_m == 5
if (m == 0 and h == 9) or (m == 30 and h == 7)
m := m + 3
idx := 3
[idx, h, m]
// Function calculate and get customized pivot points high low and time values
// param _len (int) length for the pivot points high low calculation
// param _loc (string) if set to 'wick' highest/lowest values of the detected pivot points high low will be calculated
// if set to 'Body' the highest/lowest values of the candel bodies will be returend as pivot points high low
// Returns A tuple containing (float) ph - pivot high, (float) pl - pivot low, (int) pht - pivot high unix time (int) plt - pivot low unix time
method f_getPivotPoint(int _len, _loc) =>
ph = ta.pivothigh(_len, _len)
if ph and _loc == 'Body'
ph := math.max(open[_len], close[_len])
pl = ta.pivotlow (_len, _len)
if pl and _loc == 'Body'
pl := math.min(open[_len], close[_len])
pht = ph ? time[_len] : na
plt = pl ? time[_len] : na
[ph, pl, pht, plt]
//-----------------------------------------------------------------------------}
//Main variables
//-----------------------------------------------------------------------------{
tf_m = timeframe.multiplier
bi = bar_index
var a_majorCity = array.new_string(), var a_utcTimeOffset = array.new_float(), var a_utcCity = array.new_string()
if barstate.isfirst
array.push(a_majorCity, 'NEW YORK'), array.push(a_utcTimeOffset, -5), array.push(a_utcCity, '(UTC-05:00) NEW YORK')
array.push(a_majorCity, 'LONDON' ), array.push(a_utcTimeOffset, 0 ), array.push(a_utcCity, '(UTC+00:00) LONDON' )
// Lower TF bar UDT array
ltfB = request.security_lower_tf(syminfo.tickerid, '1', bar.new())
// Lower TF pivotPoint UDT arrays
var pivotPoint p = pivotPoint.new()
[a_pH, a_pL, a_pHt, a_pLt] = request.security_lower_tf(syminfo.tickerid, '1', f_getPivotPoint(pLen, pLoc))
if not na(array.min(a_pL))
p.l := array.min(a_pL)
p.lt := array.min(a_pLt)
if not na(array.max(a_pH))
p.h := array.max(a_pH)
p.ht := array.max(a_pHt)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//units and multipliers for versatility across asset classes
pUnits = syminfo.type== 'index' or syminfo.type == 'futures'? ' $':
syminfo.type=='forex'?' pips':na
mult= str.tonumber(timeframe.period)<=5? 1: str.tonumber(timeframe.period)<=240? 60: timeframe.isdwm? 1440:na
pMult = syminfo.type== 'index' or syminfo.type == 'futures'? 1:
syminfo.type=='forex'? 100:1
tUnits = mult==1? ' mins': mult==60? ' hours':mult==1440? ' days':na
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------}
//Detect ICT macros
//-----------------------------------------------------------------------------{
var macro mc = macro.new()
// Function main function : detects macros, draws nad controls macro components and classifies macros
// param _m (bool) enable/disable specific macro
// param _msh (int) macro start hour
// param _msm (int) macro start minute
// param _mh (bool) macro top line control option
// param _ml (bool) macro bottom line control option
// param _mm (bool) macro middle line control option
// param _me (bool) macro extended lines control option
// param _mt (bool) macro label text value
//
// param _utc (string) utc and major city in the form of '(UTC-05:00) NEW YORK'
// param _dst (bool) daylight saving time
// param _tf_m (int) timeframe multiplier
// param _alert (bool) next macro time start location, displays in _alertM minutes
// param _alertM (int) alert in _alertM minutes
// Returns macro UDT components created
processMacro(_m, _msh, _msm, _mh, _ml, _mm, _me, _mt, _utc, _dst, _tf_m, _alert, _alertM) =>
if _m
[_, ha, ma] = f_getBarTime(_utc, _dst, a_utcTimeOffset, a_utcCity, _alertM, _tf_m)
if ha == _msh and ma == _msm
alert(_mt + ' macro will be in play in ' + str.tostring(_alertM) + ' minutes for instrument ' + syminfo.ticker)
if _alert
mc.lnf := line.new(time + _alertM * 60000 , high, time + _alertM * 60000, low, xloc.bar_time, extend.both, mc.color, line.style_solid , 1)
[idx, h, m] = f_getBarTime(_utc, _dst, a_utcTimeOffset, a_utcCity, 0, _tf_m)
if h == 08 or h == 07 or h == 1 or h == 3 or h == 5
if m == 0
mc.len := 10
else
mc.len := 180
if h == 11
if m == 0
mc.len := 10
else
mc.len := 300
if h == _msh and m == _msm
mc.lnf.delete()
if ltfB.size() > idx
if not na(ltfB.get(idx).h)
mc.t := ltfB.get(idx).t
mc.o := ltfB.get(idx).o
mc.top := ltfB.get(idx).h
mc.bottom := ltfB.get(idx).l
if idx == 0
mc.x2 := bi + math.round(mc.len / _tf_m)
else
mc.x2 := bi + math.round(mc.len / _tf_m) + 1
mc.lnh := line.new(bi, mc.top, int(mc.x2), mc.top, color = _mh ? mc.color : mc.nocolor, style = line.style_solid , width = 2)
mc.lnhe := line.new(int(mc.x2), mc.top, int(mc.x2), mc.top, color = _me ? _mh ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 2)
mc.lnl := line.new(bi, mc.bottom, int(mc.x2), mc.bottom, color =_ml ? mc.color : mc.nocolor, style = line.style_solid , width = 2)
mc.lnle := line.new(int(mc.x2), mc.bottom, int(mc.x2), mc.bottom, color = _me ? _ml ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 2)
mc.lnm := line.new(bi, math.avg(mc.top, mc.bottom), int(mc.x2), math.avg(mc.top, mc.bottom), color = _mm ? mc.color : mc.nocolor, style = line.style_dotted, width = 1)
mc.lnme := line.new(bi, math.avg(mc.top, mc.bottom), int(mc.x2), math.avg(mc.top, mc.bottom), color = _me ? _mm ? mc.color : mc.nocolor : mc.nocolor, style = line.style_dotted, width = 1)
mc.lf := linefill.new(mc.lnh, mc.lnl, color.new(color.gray, 100))
mc.lb := label.new(bi + int(mc.len / _tf_m / 2), mc.top, mcText != 'None' ? 'SAMURAI\n' + _mt : '', xloc.bar_index, yloc.price, #00000000, label.style_label_down, chart.fg_color, mcSize, text.align_left, '')
p.l1 := p.l
p.h1 := p.h
else if bi < int(mc.x2) and time >= mc.t
mc.top := math.max(high, mc.lnh.get_y1())
mc.lnh.set_y(mc.top), mc.lnhe.set_y(mc.top)
mc.bottom := math.min(low , mc.lnl.get_y1())
mc.lnl.set_y(mc.bottom), mc.lnle.set_y(mc.bottom)
mc.mid := math.avg(math.max(high, mc.lnh.get_y1()), math.min(low , mc.lnl.get_y1()))
mc.lnm.set_y(mc.mid), mc.lnme.set_y(mc.mid)
mc.lb.set_y(math.max(high, mc.lb.get_y()))
if not na(array.min(a_pL)) and p.lt < mc.t
p.l1 := array.min(a_pL)
if not na(array.max(a_pH)) and p.ht < mc.t
p.h1 := array.max(a_pH)
else if bi == int(mc.x2)
if ltfB.size() > idx
if not na(ltfB.get(idx).c)
mc.co := ltfB.get(idx).o
mc.ch := ltfB.get(idx).h
mc.cl := ltfB.get(idx).l
mc.cc := ltfB.get(idx).c
mc.top := math.max(mc.ch, mc.lnh.get_y1())
mc.lnh.set_y(mc.top), mc.lnhe.set_y(mc.top)
mc.bottom := math.min(mc.cl , mc.lnl.get_y1())
mc.lnl.set_y(mc.bottom), mc.lnle.set_y(mc.bottom)
mc.mid := math.avg(math.max(mc.top, mc.lnh.get_y1()), math.min(mc.bottom , mc.lnl.get_y1()))
mc.lnm.set_y(mc.mid), mc.lnme.set_y(mc.mid)
mc.lb.set_y(math.max(mc.top, mc.lb.get_y()))
if not na(array.min(a_pL)) and p.lt < mc.t
p.l1 := array.min(a_pL)
if not na(array.max(a_pH)) and p.ht < mc.t
p.h1 := array.max(a_pH)
else if mc.t == mc.t[1]
mc.lnhe.set_x2(bi), mc.lnle.set_x2(bi), mc.lnme.set_x2(bi)
if bi == int(mc.x2) + 1 and not str.contains(mc.lb.get_text(), 'on NSL')
mc.lb.set_tooltip('mc open : '+ str.tostring(mc.o , format.mintick) +
'\nmc close : ' + str.tostring(mc.cc , format.mintick) +
'\nmc top : ' + str.tostring(mc.top , format.mintick) +
'\nmc mid : ' + str.tostring(mc.mid , format.mintick) +
'\nmc bottom : ' + str.tostring(mc.bottom, format.mintick) )
if mc.bottom < p.l1 and mc.top > p.h1
if (mc.o < math.avg(mc.bottom, mc.mid) and mc.cc > math.avg(mc.top, mc.mid)) or (mc.o > math.avg(mc.top, mc.mid) and mc.cc < math.avg(mc.bottom, mc.mid))
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(mColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else if mc.bottom < p.l1 or mc.top > p.h1
if (mc.co > mc.mid and mc.cc < mc.mid) or (mc.co < mc.mid and mc.cc > mc.mid) or (mc.o < mc.mid and mc.cc < mc.mid) or (mc.o > mc.mid and mc.cc > mc.mid) // pL > pmcPL or pmcPH < pH
mc.lf.set_color(color.new(aColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
if p.l == p.l1 and p.h == p.h1 and (mc.o < math.avg(mc.bottom, mc.mid) and mc.cc > math.avg(mc.top, mc.mid)) or (mc.o > math.avg(mc.top, mc.mid) and mc.cc < math.avg(mc.bottom, mc.mid))
mc.lf.set_color(color.new(eColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
else
mc.lf.set_color(color.new(aColor, 73))
if mcText != 'None'
mc.lb.set_text(' ' + mc.lb.get_text())
//-----------------------------------------------------------------------------}
//Process macros
//-----------------------------------------------------------------------------{
if tf_m <= 15
processMacro(m07000710, 11, 00, m07_top, m07_bot, m07_mid, m07_ext, '07:00 AM - 07:10', '(UTC+00:00) LONDON' , lnSummerTime, tf_m, mcAlert, mcAlertM)
processMacro(m08000810, 08, 00, m08_top, m08_bot, m08_mid, m08_ext, '08:00 AM - 08:10', '(UTC-05:00) NEW YORK', nySummerTime, tf_m, mcAlert, mcAlertM)
else
var table note = table.new(position.bottom_right, 1, 1)
if barstate.islast
table.cell(note, 0, 0, 'ICT Macros are supported on:\n 1 min, 3, 5 mins and 15 mins charts\n\n', text_size=size.small, text_color=chart.fg_color)
//-----------------------------------------------------------------------------}
//OPEN RANGO DE ESTRATEGIA
// INPUTS
i_time = input.session ('0800-0801:1234567', "OPEN SAMURAI", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz = input ("GMT-4", "Timezone")
i_vline = input.bool (true, "VLine", inline="in1")
i_vcol = input.color (#006eff, "", inline="in1")
i_txtcol = input.color (#006eff, " Text color", inline="in1")
i_vstyle = input.string ("Solid", "Style", options=["Solid", "Dotted", "Dashed"])
i_hline = label.style_none
i_linecol = label.style_none
i_linestyle = label.style_none
i_ex = label.style_none
i_ex2 = label.style_none
i_ex3 = label.style_none
// MISC
nymidz = time ("1", i_time, i_tz)
linestyle = i_linestyle == "Solid" ? line.style_solid : i_linestyle == "Dotted" ? line.style_dotted : line.style_dashed
vstyle = i_vstyle == "Solid" ? line.style_solid : i_vstyle == "Dotted" ? line.style_dotted : line.style_dashed
ex = i_ex == "1 Day" ? extend.none : i_ex == "2 Days" ? extend.none : i_ex == "Right" ? extend.right : extend.both
htime = i_ex == "2 Days" ? 172800000 : 86400000
hourtime = label.style_none
// CALC
var openprice = 0.0
if nymidz
if not nymidz[1]
openprice := open
else
openprice := math.max(open, openprice)
// OBJECTS
var label lb = na
if openprice != openprice[1]
var line lne = na
line.set_x2(lne, nymidz)
line.set_extend(lne, extend.none)
if i_vline and nymidz == nymidz
vl1 = line.new(nymidz, high, nymidz, low, xloc.bar_time, extend.both, i_vcol, vstyle, 1)
if line.get_y1(vl1) == line.get_y2(vl1)
line.delete(vl1)
///////////////////////////////////////////////////////////////////////////////////
//CLOSE RANGO DE ESTRATEGIA
// INPUTS
i_time0 = input.session ('0810-0811:1234567', "CLOSE SAMURAI", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz0 = i_tz
i_vline0 = i_vline
i_vcol0 = i_vcol
i_txtcol0 = i_txtcol
i_vstyle0 = i_vstyle
i_hline0 = label.style_none
i_linecol0 = label.style_none
i_linestyle0 = label.style_none
i_ex0 = label.style_none
i_ex20 = label.style_none
i_ex30 = label.style_none
// MISC
nymid0 = time ("1", i_time0, i_tz0)
linestyle0 = i_linestyle0 == "Solid" ? line.style_solid : i_linestyle0 == "Dotted" ? line.style_dotted : line.style_dashed
vstyle0 = i_vstyle0 == "Solid" ? line.style_solid : i_vstyle0 == "Dotted" ? line.style_dotted : line.style_dashed
ex0 = i_ex0 == "1 Day" ? extend.none : i_ex0 == "2 Days" ? extend.none : i_ex0 == "Right" ? extend.right : extend.both
htime0 = i_ex0 == "2 Days" ? 172800000 : 86400000
hourtime0 = label.style_none
// CALC
var openprice0 = 0.0
if nymid0
if not nymid0[1]
openprice0 := open
else
openprice0 := math.max(open, openprice0)
// OBJECTS
var label lb0 = na
if openprice0 != openprice0[1]
var line lne0 = na
line.set_x2(lne0, nymid0)
line.set_extend(lne0, extend.none)
if i_vline0 and nymid0 == nymid0
vl10 = line.new(nymid0, high, nymid0, low, xloc.bar_time, extend.both, i_vcol0, vstyle0, 1)
if line.get_y1(vl10) == line.get_y2(vl10)
line.delete(vl10)
///////////////////////////////////////////////////////////////////////////////////////////////
//CLOSE MAX 8:45
// INPUTS
i_time1 = input.session ('0845-0846:1234567', "END", tooltip="Different exchanges will have difference time zones so change accordingly.")
i_tz1 = i_tz
i_vline1 = i_vline
i_vcol1 = i_vcol
i_txtcol1 = i_txtcol
i_vstyle1 = i_vstyle
i_hline1 = label.style_none
i_linecol1 = label.style_none
i_linestyle1 = label.style_none
i_ex1 = label.style_none
i_ex21 = label.style_none
i_ex31 = label.style_none
// MISC
nymid1 = time ("1", i_time1, i_tz1)
linestyle1 = i_linestyle1 == "Solid" ? line.style_solid : i_linestyle1 == "Dotted" ? line.style_dotted : line.style_dashed
vstyle1 = i_vstyle1 == "Solid" ? line.style_solid : i_vstyle1 == "Dotted" ? line.style_dotted : line.style_dashed
ex1 = i_ex1 == "1 Day" ? extend.none : i_ex1 == "2 Days" ? extend.none : i_ex1 == "Right" ? extend.right : extend.both
htime1 = i_ex1 == "2 Days" ? 172800000 : 86400000
hourtime1 = label.style_none
// CALC
var openprice1 = 0.0
if nymid1
if not nymid1[1]
openprice1 := open
else
openprice1 := math.max(open, openprice1)
// OBJECTS
var label lb1 = na
if openprice1 != openprice1[1]
var line lne1 = na
line.set_x2(lne1, nymid1)
line.set_extend(lne1, extend.none)
if i_vline1 and nymid1 == nymid1
vl11 = line.new(nymid1, high, nymid1, low, xloc.bar_time, extend.both, i_vcol1, vstyle1, 1)
if line.get_y1(vl11) == line.get_y2(vl11)
line.delete(vl11)
// EN
Script de código aberto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Aviso legal
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Script de código aberto
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Aviso legal
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.