Mas alla de los built-in
Pine Script tiene 20+ indicadores built-in (RSI, MACD, EMA, etc). Pero la magia esta en crear los tuyos — combinaciones, modificaciones, indicadores que NO existen en otras plataformas.
En esta pagina, 3 indicadores avanzados completos con codigo funcional listo para copiar.
Indicador 1: Triple EMA + Trend Detection
Sistema de 3 EMAs (8/21/50) con detección automatica de tendencia:
//@version=5 indicator(«Triple EMA Trend PT», overlay=true) fastLen = input.int(8, «EMA Rapida», minval=1)
medLen = input.int(21, «EMA Media», minval=1)
slowLen = input.int(50, «EMA Lenta», minval=1)
showBg = input.bool(true, «Background tendencia») emaFast = ta.ema(close, fastLen)
emaMed = ta.ema(close, medLen)
emaSlow = ta.ema(close, slowLen) bullish = emaFast > emaMed and emaMed > emaSlow and close > emaFast
bearish = emaFast < emaMed and emaMed < emaSlow and close < emaFast
sideways = not bullish and not bearish fastColor = bullish ? color.green : bearish ? color.red : color.gray
medColor = #b8893d
slowColor = color.blue plot(emaFast, «EMA 8», color=fastColor, linewidth=1) plot(emaMed, «EMA 21», color=medColor, linewidth=2) plot(emaSlow, «EMA 50», color=slowColor, linewidth=2) bgClr = bullish ? color.new(color.green, 95) :
bearish ? color.new(color.red, 95) :
na bgcolor(showBg ? bgClr : na, title=«Tendencia») if bullish and not bullish[1] label.new(bar_index, low, «↑ Bullish»,
color=color.green, textcolor=color.white, style=label.style_label_up) if bearish and not bearish[1] label.new(bar_index, high, «↓ Bearish»,
color=color.red, textcolor=color.white, style=label.style_label_down) alertcondition(bullish and not bullish[1], «Cambio Bullish», «Tendencia cambio a alcista») alertcondition(bearish and not bearish[1], «Cambio Bearish», «Tendencia cambio a bajista»)
Caracteristicas:
- 3 EMAs visibles con colores dinamicos
- Background colorido segun tendencia activa
- Etiquetas automaticas en cambios de tendencia
- Alertas listas para configurar
- Inputs editables (puedes cambiar a 9/21/55 o 5/13/34, etc)
Indicador 2: Volume Profile simplificado
Visualiza niveles de volumen para identificar soportes/resistencias:
//@version=5 indicator(«Volume Levels PT», overlay=true) lookback = input.int(100, «Periodo lookback»)
threshold = input.float(2.0, «Multiplicador volumen alto») volAvg = ta.sma(volume, lookback) isHighVolume = volume > volAvg * threshold var array<float> highVolLevels = array.new<float>() if isHighVolume array.push(highVolLevels, close) label.new(bar_index, low – (high-low)*0.05, «V↑», color=color.new(#b8893d, 50),
textcolor=color.white, size=size.tiny, style=label.style_label_up) if array.size(highVolLevels) > 20 array.shift(highVolLevels) if barstate.islast and array.size(highVolLevels) > 0 for i = 0 to array.size(highVolLevels) – 1 level = array.get(highVolLevels, i) line.new(bar_index – 50, level, bar_index + 5, level,
color=color.new(#b8893d, 70), width=1,
style=line.style_dashed, extend=extend.none) alertcondition(isHighVolume, «Volumen Alto», «Volumen extraordinario detectado»)
Que hace:
- Detecta barras con volumen 2x+ del promedio
- Marca con etiqueta «V↑»
- Dibuja lineas horizontales en esos niveles
- Estos niveles suelen actuar como S/R futuros
Indicador 3: Sesion Markers
Identifica sesiones de Asia, Londres, NY visualmente. Util para day traders mexicanos:
//@version=5 indicator(«Sesiones Mexico PT», overlay=true) asia = input.session(«0000-0900», «Asia (UTC)»)
londres = input.session(«0700-1600», «Londres (UTC)»)
ny = input.session(«1200-2100», «Nueva York (UTC)»)
overlap = input.session(«1200-1600», «Overlap Lon-NY (UTC)») inAsia = not na(time(timeframe.period, asia))
inLondres = not na(time(timeframe.period, londres))
inNY = not na(time(timeframe.period, ny))
inOverlap = not na(time(timeframe.period, overlap)) bgcolor(inAsia ? color.new(color.blue, 95) : na, title=«Asia») bgcolor(inLondres ? color.new(color.green, 95) : na, title=«Londres») bgcolor(inNY ? color.new(color.purple, 95) : na, title=«NY») bgcolor(inOverlap ? color.new(color.orange, 85) : na, title=«Overlap Lon-NY») var float asiaHigh = na var float asiaLow = na var float londHigh = na var float londLow = na if inAsia and not inAsia[1]
asiaHigh := high
asiaLow := low else if inAsia
asiaHigh := math.max(asiaHigh, high)
asiaLow := math.min(asiaLow, low) plot(inLondres or inNY ? asiaHigh : na, «Asia High»,
color=color.new(color.blue, 30), style=plot.style_linebr) plot(inLondres or inNY ? asiaLow : na, «Asia Low»,
color=color.new(color.blue, 30), style=plot.style_linebr)
Caracteristicas:
- Backgrounds diferenciados por sesion
- Overlap Londres-NY marcado especialmente (sesion ideal para mexicanos)
- Rango de Asia dibujado para usar en estrategia London Breakout
- Configurable para tu zona horaria
Combinaciones poderosas
El verdadero poder es combinar indicadores. Algunos ejemplos:
- Triple EMA + RSI: solo entrar LONG si EMAs bullish Y RSI > 50
- Triple EMA + Volume Levels: confirmar pullbacks con volumen
- Sesion Markers + Bollinger: operar mean reversion solo en sesion Asia
- Triple EMA + Sesion Markers: operar trend solo en Londres-NY overlap
Pide a Claude/ChatGPT: «Combina estos 2 indicadores: [pegar codigo A] y [pegar codigo B] en una version unica.»
Errores comunes en indicadores custom
- Repaint: indicadores que cambian valores pasados — peligroso si no lo entiendes
- Lookahead: usar datos futuros accidentalmente
- Mezclar timeframes sin
request.security() - Olvidar manejar NA en primeras barras
- Sobre-cargar visualmente: 15+ plots = chart ilegible