OPEN-SOURCE SCRIPT

Evil MACD Trading System (Pine Script v6)

282
Indicator Overview
The Evil MACD Trading System is an enhanced version of the classic MACD indicator, optimized for TradingView with Pine Script v6. It integrates trend filtering, volume confirmation, and precision signal positioning to reduce false signals and improve trading decision accuracy—distinguishing itself from the traditional 12/26/9 MACD by focusing on trend-aligned entries and exits.

Core Logic & Features

1. Enhanced MACD Calculation

Departing from the standard MACD parameters, this system uses customizable fast (default:14), slow (default:28), and signal (default:8) periods to adapt to different market volatility and asset types (stocks, futures, cryptos). The core DIF, DEA, and histogram are retained while optimized for better sensitivity to medium-term trends.

2. Trend Filtering Mechanism

A 60-period EMA (adjustable) acts as the primary trend filter, ensuring buy signals only trigger in uptrends (price above EMA) and sell signals in downtrends (price below EMA). This avoids counter-trend trades and minimizes exposure to sideways market noise.

3. Volume Confirmation (Toggleable)

The optional volume filter validates signals by requiring trading volume to exceed 120% of the 20-period average volume. This ensures entries/exits are supported by capital flow, reducing false breakouts/breakdowns.

4. Precision Signal Positioning

Signals are overlaid directly on the price chart (not the subwindow) for intuitive price correlation. Buy signals (green upward triangles + "Buy" label) attach to the bottom of candlesticks, while sell signals (red downward triangles + "Sell" label) align with candlestick highs—adjustable offset parameters let users fine-tune signal proximity to price.

Usage Guidelines

- Buy Signal: Triggered when DIF crosses above DEA, price stays above the 60-period EMA, and volume (if enabled) meets the 120% threshold.

- Sell Signal: Triggered when DIF crosses below DEA, price stays below the 60-period EMA, and volume (if enabled) meets the 120% threshold.

- Customization: Adjust MACD periods, trend filter length, volume sensitivity, and signal offset to match your trading style (scalping, swing trading) and target assets.

Compatibility & Notes

Built for Pine Script v6 (latest TradingView version) with no syntax errors. The indicator supports all timeframes and asset classes. For best results, combine with additional technical tools (support/resistance, RSI) for multi-factor confirmation. Disable the volume filter in low-liquidity markets to avoid missing valid signals.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.