Indicator · Pine Script v6 · On the chart

M45 Indicator - Aurolo

by dtheran1· code credited to M45 indicator - Aurolo

A trend indicator for the price chart that draws a moving-average trend line, 45 periods by default and selectable as SMA, EMA, WMA, HMA or VWMA, offset by an ATR multiple.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code280
Settings19inputs
LicenceNone statedfile: MPL-2.0
Last update6 months ago17 Apr 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

280 lines of Pine Script v6 from M45_aurolo.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

M45_aurolo.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © M45 indicator - Aurolo
// Indicador de tendencia con detección de presión de compra y venta

//@version=6
indicator("M45 indicator - Aurolo", overlay = true, max_bars_back = 500)

// ============================================================================
// INPUTS - CONFIGURACIÓN
// ============================================================================

// Tendencial Settings
trendLength = input.int(45, "Longitud de Tendencial", minval = 1, maxval = 200, group = "═══ TENDENCIAL ═══")
trendType = input.string("HMA", "Tipo de Media", options = ["SMA", "EMA", "WMA", "HMA", "VWMA"], group = "═══ TENDENCIAL ═══")
atrMultiplier = input.float(2.0, "ATR Multiplicador", minval = 0.1, step = 0.1, group = "═══ TENDENCIAL ═══", tooltip = "Ajusta la distancia de la tendencial del precio")
atrPeriod = input.int(14, "Período ATR", minval = 1, group = "═══ TENDENCIAL ═══")

// Presión de Compra/Venta
enableBarColor = input.bool(true, "Colorear Velas", group = "═══ PRESIÓN COMPRA/VENTA ═══")
pressureThreshold = input.float(1.5, "Umbral de Presión", minval = 0.5, step = 0.1, group = "═══ PRESIÓN COMPRA/VENTA ═══", tooltip = "Mayor valor = señales más fuertes")

// Colores
bullColor = input.color(#00ff88, "Color Alcista", group = "═══ COLORES ═══", inline = "col1")
bearColor = input.color(#ff0055, "Color Bajista", group = "═══ COLORES ═══", inline = "col1")
neutralColor = input.color(#888888, "Color Neutral", group = "═══ COLORES ═══", inline = "col2")

// Alertas
enableAlerts = input.bool(true, "Activar Alertas", group = "═══ ALERTAS ═══")
alertTouchTrend = input.bool(true, "Alerta: Toque en Tendencial", group = "═══ ALERTAS ═══")
alertPressure = input.bool(true, "Alerta: Presión Fuerte", group = "═══ ALERTAS ═══")
alertTrendChange = input.bool(true, "Alerta: Cambio de Tendencia", group = "═══ ALERTAS ═══")

// Visualización
showTrendLine = input.bool(true, "Mostrar Línea Tendencial", group = "═══ VISUALIZACIÓN ═══")
trendLineWidth = input.int(2, "Grosor Línea", minval = 1, maxval = 5, group = "═══ VISUALIZACIÓN ═══")
showFill = input.bool(true, "Rellenar Área", group = "═══ VISUALIZACIÓN ═══")
fillTransparency = input.int(90, "Transparencia Relleno", minval = 0, maxval = 100, group = "═══ VISUALIZACIÓN ═══")

// ============================================================================
// FUNCIONES - CÁLCULO DE MEDIAS
// ============================================================================

// Función HMA (Hull Moving Average)
hma(src, length) =>
    wma1 = ta.wma(src, length / 2)
    wma2 = ta.wma(src, length)
    ta.wma(2 * wma1 - wma2, math.floor(math.sqrt(length)))

// Función para obtener la media según el tipo
getMA(src, length, maType) =>
    switch maType
        "SMA" => ta.sma(src, length)
        "EMA" => ta.ema(src, length)
        "WMA" => ta.wma(src, length)
        "HMA" => hma(src, length)
        "VWMA" => ta.vwma(src, length)
        => ta.sma(src, length)

// ============================================================================
// CÁLCULO DE LA TENDENCIAL
// ============================================================================

// Calcular ATR para distancia dinámica
atr = ta.atr(atrPeriod)

// Media base
baseMA = getMA(close, trendLength, trendType)

// Determinar dirección de tendencia
trendUp = close > baseMA
trendDown = close < baseMA

// Calcular línea tendencial con offset ATR
trendLine = trendUp ? baseMA - (atr * atrMultiplier) : baseMA + (atr * atrMultiplier)

// Suavizar la línea tendencial para evitar saltos bruscos
smoothTrendLine = ta.ema(trendLine, 3)

// Detectar cambio de tendencia
var bool previousTrend = true  // true = alcista, false = bajista
currentTrend = close > smoothTrendLine
trendChanged = currentTrend != previousTrend
previousTrend := currentTrend

// ============================================================================
// DETECCIÓN DE PRESIÓN DE COMPRA Y VENTA
// ============================================================================

// Calcular el rango del cuerpo de la vela
bodySize = math.abs(close - open)
candleRange = high - low

// Ratio del cuerpo respecto al rango total
bodyRatio = candleRange > 0 ? bodySize / candleRange : 0

// Detectar velas alcistas y bajistas fuertes
strongBullCandle = close > open and bodyRatio > 0.6 and bodySize > atr * 0.5
strongBearCandle = close < open and bodyRatio > 0.6 and bodySize > atr * 0.5

// Calcular presión usando volumen y momentum
volumeMA = ta.sma(volume, 20)
volumeRatio = volume / volumeMA

// Momentum
momentum = ta.change(close, 1)
momentumMA = ta.sma(momentum, 10)

// Presión de compra: vela alcista + volumen alto + momentum positivo
buyPressure = close > open and volumeRatio > pressureThreshold and momentum > momentumMA and strongBullCandle

// Presión de venta: vela bajista + volumen alto + momentum negativo  
sellPressure = close < open and volumeRatio > pressureThreshold and momentum < momentumMA and strongBearCandle

// Estado de presión (para colorear velas)
var int pressureState = 0  // 1 = compra, -1 = venta, 0 = neutral

if buyPressure
    pressureState := 1
else if sellPressure
    pressureState := -1
else if close > open and close > smoothTrendLine
    pressureState := 1
else if close < open and close < smoothTrendLine
    pressureState := -1
else
    pressureState := 0

// ============================================================================
// DETECCIÓN DE TOQUE EN TENDENCIAL
// ============================================================================

// Detectar cuando el precio toca la tendencial
touchThreshold = atr * 0.3
priceTouchedTrend = math.abs(close - smoothTrendLine) < touchThreshold or 
                    (low <= smoothTrendLine + touchThreshold and high >= smoothTrendLine - touchThreshold)

// Evitar alertas múltiples en la misma zona
var int lastTouchBar = 0
newTouch = priceTouchedTrend and (bar_index - lastTouchBar) > 3
if newTouch
    lastTouchBar := bar_index

// ============================================================================
// PLOTEO - VISUALIZACIÓN
// ============================================================================

// Color de la línea tendencial según tendencia
trendColor = currentTrend ? bullColor : bearColor

// Plotear línea tendencial
plot(showTrendLine ? smoothTrendLine : na, "Tendencial M45", color = trendColor, linewidth = trendLineWidth)

// Rellenar área entre precio y tendencial
pricePlot = plot(close, display = display.none)
trendPlot = plot(showTrendLine ? smoothTrendLine : na, display = display.none)

fill(pricePlot, trendPlot, 
     color = showFill ? color.new(currentTrend ? bullColor : bearColor, fillTransparency) : na,
     title = "Relleno Tendencial")

// ============================================================================
// COLOREO DE VELAS
// ============================================================================

// Asignar color a las velas según presión
barColor = enableBarColor ? 
           (pressureState == 1 ? bullColor : 
            pressureState == -1 ? bearColor : 
            neutralColor) : na

barcolor(barColor, title = "Color de Vela")

// ============================================================================
// SEÑALES VISUALES
// ============================================================================

// Señal de cambio de tendencia
plotshape(trendChanged and currentTrend, "Cambio Alcista", shape.triangleup, 
          location.belowbar, bullColor, size = size.small, offset = 0)
plotshape(trendChanged and not currentTrend, "Cambio Bajista", shape.triangledown, 
          location.abovebar, bearColor, size = size.small, offset = 0)

// Señal de presión fuerte
plotshape(buyPressure, "Presión Compra", shape.circle, 
          location.belowbar, color.new(bullColor, 30), size = size.tiny)
plotshape(sellPressure, "Presión Venta", shape.circle, 
          location.abovebar, color.new(bearColor, 30), size = size.tiny)

// Señal de toque en tendencial
plotchar(newTouch, "Toque Tendencial", "•", location.absolute, 
         color.new(color.yellow, 0), size = size.small, char = smoothTrendLine)

// ============================================================================
// ALERTAS
// ============================================================================

if enableAlerts
    // Alerta: Toque en tendencial
    if alertTouchTrend and newTouch
        alert("M45: Precio tocó la tendencial en " + str.tostring(close), alert.freq_once_per_bar)
    
    // Alerta: Presión de compra
    if alertPressure and buyPressure
        alert("M45: ¡PRESIÓN DE COMPRA DETECTADA! Precio: " + str.tostring(close), alert.freq_once_per_bar)
    
    // Alerta: Presión de venta
    if alertPressure and sellPressure
        alert("M45: ¡PRESIÓN DE VENTA DETECTADA! Precio: " + str.tostring(close), alert.freq_once_per_bar)
    
    // Alerta: Cambio de tendencia alcista
    if alertTrendChange and trendChanged and currentTrend
        alert("M45: ★ CAMBIO A TENDENCIA ALCISTA ★", alert.freq_once_per_bar)
    
    // Alerta: Cambio de tendencia bajista
    if alertTrendChange and trendChanged and not currentTrend
        alert("M45: ★ CAMBIO A TENDENCIA BAJISTA ★", alert.freq_once_per_bar)

// ============================================================================
// DASHBOARD INFORMATIVO (OPCIONAL)
// ============================================================================

showDashboard = input.bool(true, "Mostrar Dashboard", group = "═══ DASHBOARD ═══")
dashPosition = input.string("Top Right", "Posición", 
                           options = ["Top Left", "Top Right", "Bottom Left", "Bottom Right"],
                           group = "═══ DASHBOARD ═══")

if showDashboard and barstate.islast
    // Determinar posición
    tablePos = dashPosition == "Top Left" ? position.top_left :
               dashPosition == "Top Right" ? position.top_right :
               dashPosition == "Bottom Left" ? position.bottom_left :
               position.bottom_right
    
    // Crear tabla
    var table dashTable = table.new(tablePos, 2, 6, 
                                    bgcolor = color.new(color.black, 10),
                                    border_color = color.gray,
                                    border_width = 1)
    
    // Encabezado
    table.cell(dashTable, 0, 0, "M45 AUROLO", text_color = color.white, 
              bgcolor = color.new(color.blue, 50), text_size = size.normal)
    table.merge_cells(dashTable, 0, 0, 1, 0)
    
    // Tendencia actual
    trendText = currentTrend ? "ALCISTA ▲" : "BAJISTA ▼"
    trendCellColor = currentTrend ? color.new(bullColor, 70) : color.new(bearColor, 70)
    table.cell(dashTable, 0, 1, "Tendencia:", text_color = color.white)
    table.cell(dashTable, 1, 1, trendText, text_color = color.white, bgcolor = trendCellColor)
    
    // Presión actual
    pressureText = pressureState == 1 ? "COMPRA" : 
                   pressureState == -1 ? "VENTA" : "NEUTRAL"
    pressureCellColor = pressureState == 1 ? color.new(bullColor, 70) : 
                        pressureState == -1 ? color.new(bearColor, 70) : 
                        color.new(neutralColor, 70)
    table.cell(dashTable, 0, 2, "Presión:", text_color = color.white)
    table.cell(dashTable, 1, 2, pressureText, text_color = color.white, bgcolor = pressureCellColor)
    
    // Distancia a tendencial
    distancePercent = ((close - smoothTrendLine) / smoothTrendLine) * 100
    distanceText = str.tostring(math.abs(distancePercent), "#.##") + "%"
    distanceDir = distancePercent > 0 ? "Arriba" : "Abajo"
    table.cell(dashTable, 0, 3, "Distancia:", text_color = color.white)
    table.cell(dashTable, 1, 3, distanceText + " " + distanceDir, text_color = color.white)
    
    // ATR actual
    atrText = str.tostring(atr, "#.##")
    table.cell(dashTable, 0, 4, "ATR:", text_color = color.white)
    table.cell(dashTable, 1, 4, atrText, text_color = color.white)
    
    // Volumen relativo
    volText = str.tostring(volumeRatio, "#.##") + "x"
    volColor = volumeRatio > pressureThreshold ? color.orange : color.white
    table.cell(dashTable, 0, 5, "Volumen:", text_color = color.white)
    table.cell(dashTable, 1, 5, volText, text_color = volColor)

// ============================================================================
// FIN DEL INDICADOR M45
// ============================================================================

Overview

M45 Indicator - Aurolo detects buying and selling pressure with an adjustable threshold, and can colour candles and fill the area by direction. Alerts are available for touches of the trend line, strong pressure and trend changes. An optional dashboard is placed in a chosen corner. Labels and inputs are in Spanish.

Details

Published by

dtheran1 on GitHub

Code credit

M45 indicator - Aurolo, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Longitud de Tendencialint45trendLength
Tipo de MediastringHMAtrendType
ATR Multiplicadorfloat2.0atrMultiplier
Período ATRint14atrPeriod
Colorear VelasbooltrueenableBarColor
Umbral de Presiónfloat1.5pressureThreshold
Color Alcistacolor#00ff88bullColor
Color Bajistacolor#ff0055bearColor
Color Neutralcolor#888888neutralColor
Activar AlertasbooltrueenableAlerts
Alerta: Toque en TendencialbooltruealertTouchTrend
Alerta: Presión FuertebooltruealertPressure
Show all 19 settings
SettingTypeDefaultVariable
Alerta: Cambio de TendenciabooltruealertTrendChange
Mostrar Línea TendencialbooltrueshowTrendLine
Grosor Líneaint2trendLineWidth
Rellenar ÁreabooltrueshowFill
Transparencia Rellenoint90fillTransparency
Mostrar DashboardbooltrueshowDashboard
PosiciónstringTop RightdashPosition
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

228 stars

TradersPost Trading Checklist is an overlay indicator that evaluates a suite of popular technical conditions for long and short trade setups. It checks session-anchored VWAP, fast and slow EMA alignments and crosses, 200 SMA, RSI overbought or oversold conditi

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of TradersPost Trading Checklist
92 stars

This indicator plots five moving averages of a chosen source on the price chart, defaulting to EMA lengths 10, 20, 30, 40 and 50. The user can switch the average type to SMA, WMA or HMA and recolor each line. Wide translucent glows sit under the lines, and sof

Indicator v5 TrendMoving averages
Updated 2 months ago · Custom licence GitHub repository of Moon Dev Rainbow MA Ribbon 10-50

EMA Ribbon Overlay

by iamrichardD
57 stars

Calculates exponential moving averages for fast, pivot, and slow lengths along with optional 50, 100, and 200 simple moving average context lines. It visualizes bullish and bearish ribbon fills on the main price chart alongside MACD calculations to generate ea

Indicator v6 TrendMoving averages
Updated 1 year ago · Apache-2.0 GitHub repository of EMA Ribbon Overlay
53 stars

This indicator analyzes historical candle direction and price range over a configurable lookback window to gauge market trend. It categorizes trend direction using candle count, price range sum, or both. Signals are filtered using a Simple Moving Average to en

Indicator v6 TrendOscillators & momentum
Updated 2 months ago · MPL-2.0 GitHub repository of Candle Counter + MA + RSI + Mode
43 stars

This indicator evaluates market momentum and risk by calculating trend metrics and volatility stats, displaying them in an on-chart table pane. It measures short-term and long-term trend strength via two MACD configurations built on three customizable EMA leng

Indicator v5 TrendVolatility & bands
Updated 1 year ago · None stated GitHub repository of Trend Strength & Volatility

Market Monitor - 15m

by chris-c-thomas
14 stars

Market Monitor - 15m is a directional bias chart overlay designed for 15-minute intraday chart analysis. It calculates a triple exponential moving average ribbon with EMA cloud shading, session VWAP with multiplier bands, prior day levels, a 30-minute opening

Indicator v6 TrendMoving averages
Updated 6 months ago · MIT GitHub repository of Market Monitor - 15m

More Trend scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers