OPEN-SOURCE SCRIPT
EMA 12/21 Crossover with ATR-based SL/TP

๐ Ultimate Scalper v2
Strategy Type: Trend-Pullback Scalping
Indicators Used: EMA (12/21), MACD Histogram, ADX, ATR
Platform: TradingView (Pine Script v5)
Author: [Your Name or Handle]
๐ฏ Strategy Overview
The Ultimate Scalper v2 is a scalping strategy that catches pullbacks within short-term trends using a dynamic combination of 12/21 EMA bands, MACD Histogram crossovers, and ADX for trend confirmation. It uses ATR-based stop-loss and take-profit levels, making it suitable for volatility-sensitive environments.
๐ง Logic Breakdown
๐ Trend Detection
Uses the 12 EMA and 21 EMA to identify the short-term trend:
Uptrend: EMA 12 > EMA 21 and ADX > threshold
Downtrend: EMA 12 < EMA 21 and ADX > threshold
The ADX (default: 25) filters out low-momentum environments.
๐ Pullback Identification
Once a trend is detected:
A pullback is flagged when the MACD Histogram moves against the trend (below 0 in uptrend, above 0 in downtrend).
An entry signal is triggered when the histogram crosses back through zero (indicating momentum is resuming in the trend direction).
๐ข Entry Conditions
Long Entry:
EMA 12 > EMA 21
ADX > threshold
MACD Histogram was below 0 and crosses above 0
Short Entry:
EMA 12 < EMA 21
ADX > threshold
MACD Histogram was above 0 and crosses below 0
โ Exit Logic (ATR-based)
The strategy calculates stop-loss and take-profit levels using ATR at the time of entry:
Stop-Loss: Entry Price โ/+ ATR ร Multiplier
Take-Profit: Entry Price ยฑ ATR ร 2 ร Multiplier
Default ATR Multiplier: 1.0
โ๏ธ Customizable Inputs
ADX Threshold: Minimum trend strength for trades (default: 25)
ATR Multiplier: Controls SL/TP distance (default: 1.0)
๐ Visuals
EMA 12 and EMA 21 band can be added manually for visual reference.
Entry and exit signals are plotted via TradingViewโs built-in backtesting engine.
โ ๏ธ Disclaimer
This is a backtesting strategy, not financial advice. Performance varies across markets and timeframes. Always combine with additional confluence or risk management when going live.
Strategy Type: Trend-Pullback Scalping
Indicators Used: EMA (12/21), MACD Histogram, ADX, ATR
Platform: TradingView (Pine Script v5)
Author: [Your Name or Handle]
๐ฏ Strategy Overview
The Ultimate Scalper v2 is a scalping strategy that catches pullbacks within short-term trends using a dynamic combination of 12/21 EMA bands, MACD Histogram crossovers, and ADX for trend confirmation. It uses ATR-based stop-loss and take-profit levels, making it suitable for volatility-sensitive environments.
๐ง Logic Breakdown
๐ Trend Detection
Uses the 12 EMA and 21 EMA to identify the short-term trend:
Uptrend: EMA 12 > EMA 21 and ADX > threshold
Downtrend: EMA 12 < EMA 21 and ADX > threshold
The ADX (default: 25) filters out low-momentum environments.
๐ Pullback Identification
Once a trend is detected:
A pullback is flagged when the MACD Histogram moves against the trend (below 0 in uptrend, above 0 in downtrend).
An entry signal is triggered when the histogram crosses back through zero (indicating momentum is resuming in the trend direction).
๐ข Entry Conditions
Long Entry:
EMA 12 > EMA 21
ADX > threshold
MACD Histogram was below 0 and crosses above 0
Short Entry:
EMA 12 < EMA 21
ADX > threshold
MACD Histogram was above 0 and crosses below 0
โ Exit Logic (ATR-based)
The strategy calculates stop-loss and take-profit levels using ATR at the time of entry:
Stop-Loss: Entry Price โ/+ ATR ร Multiplier
Take-Profit: Entry Price ยฑ ATR ร 2 ร Multiplier
Default ATR Multiplier: 1.0
โ๏ธ Customizable Inputs
ADX Threshold: Minimum trend strength for trades (default: 25)
ATR Multiplier: Controls SL/TP distance (default: 1.0)
๐ Visuals
EMA 12 and EMA 21 band can be added manually for visual reference.
Entry and exit signals are plotted via TradingViewโs built-in backtesting engine.
โ ๏ธ Disclaimer
This is a backtesting strategy, not financial advice. Performance varies across markets and timeframes. Always combine with additional confluence or risk management when going live.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.