MACD Custom Settings
Institutional execution rules, audit-clean Pine Script v5 source code, and automated multi-ticker scanning.
What Is MACD Custom Settings?
The Moving Average Convergence Divergence (MACD) shows the relationship between two moving averages. The standard settings (12, 26, 9) work well for swing trading, but day traders often use faster settings like (5, 13, 1) or (8, 17, 9) for quicker signals.
Execution Rules & Setup Playbook
Institutional Playbook: Buy when MACD crosses above the signal line (bullish crossover). Sell when MACD crosses below the signal line. The histogram shows momentum - growing green bars confirm bullish trend, growing red bars confirm bearish trend.
Pine Script v5 Source Code
TradingView Pine Editor → Paste → Add to Chart//@version=5
indicator("MACD Custom", overlay=false)
// Inputs - Customize these for your trading style
fastLength = input.int(12, "Fast Length", minval=1)
slowLength = input.int(26, "Slow Length", minval=1)
signalLength = input.int(9, "Signal Length", minval=1)
// Calculate MACD
fastMA = ta.ema(close, fastLength)
slowMA = ta.ema(close, slowLength)
macdLine = fastMA - slowMA
signalLine = ta.ema(macdLine, signalLength)
histogram = macdLine - signalLine
// Crossover signals
bullishCross = ta.crossover(macdLine, signalLine)
bearishCross = ta.crossunder(macdLine, signalLine)
// Colors
histColor = histogram >= 0 ? (histogram > histogram[1] ? color.lime : color.green) : (histogram < histogram[1] ? color.red : color.maroon)
// Plots
plot(macdLine, "MACD", color=color.blue, linewidth=2)
plot(signalLine, "Signal", color=color.orange, linewidth=2)
plot(histogram, "Histogram", color=histColor, style=plot.style_histogram, linewidth=2)
// Signal markers
plotshape(bullishCross, "Bullish Cross", shape.triangleup, location.bottom, color.green, size=size.small)
plotshape(bearishCross, "Bearish Cross", shape.triangledown, location.top, color.red, size=size.small)
Related Pine Script v5 Guides
Scan Without Coding
Skip single-chart limits — Tradestie monitors this setup across 5,000+ US stocks automatically.
- Real-time multi-ticker signal scanning
- Institutional options & GEX confirmation
- Automated email alerts on triggers