OPEN-SOURCE SCRIPT
PSAR with ATR Trailing Stop + SMA Filter

📈 Strategy Overview: PSAR + 6×ATR Trailing Stop with SMA Filter
This strategy is built around the principle of “Cut the losers, let the winners run” — a disciplined, trend-following approach that combines the Parabolic SAR indicator with dynamic risk management and a Simple Moving Average (SMA) trend filter.
🔍 Strategy Logic
Trend Filter Trades are only taken in the direction of the prevailing trend, defined by a user-selected SMA (default: 100).
✅ Long trades only when price is above the SMA
✅ Short trades only when price is below the SMA
Entry Signal: A trade is triggered when the Parabolic SAR flips to the opposite side of the price bars, signaling a potential trend reversal.
Stop Loss: The stop loss is dynamically set at 6×ATR from the entry price. This adapts to market volatility and is recalculated every bar — effectively acting as a trailing stop.
Exit Logic: There is no fixed take profit. The trade remains open until the trailing stop is hit — allowing winners to run and losers to be cut quickly.
Risk Management: Each trade risks 0.5% of total equity, ensuring consistent position sizing and capital preservation.
📊 Visual Elements
PSAR dots mark trend direction changes
SMA line shows the broader trend filter
Trailing stop crosses (with 50% opacity) indicate the current stop level without cluttering the chart
⚙️ Customizable Inputs
PSAR parameters: Start, Increment, Maximum
ATR length and multiplier
SMA length
Risk percentage per trade
This strategy is ideal for traders who want to stay aligned with the trend, automate disciplined exits, and avoid emotional decision-making. Clean, simple, and powerful.
Wishing you calm and successful trades!
This strategy is built around the principle of “Cut the losers, let the winners run” — a disciplined, trend-following approach that combines the Parabolic SAR indicator with dynamic risk management and a Simple Moving Average (SMA) trend filter.
🔍 Strategy Logic
Trend Filter Trades are only taken in the direction of the prevailing trend, defined by a user-selected SMA (default: 100).
✅ Long trades only when price is above the SMA
✅ Short trades only when price is below the SMA
Entry Signal: A trade is triggered when the Parabolic SAR flips to the opposite side of the price bars, signaling a potential trend reversal.
Stop Loss: The stop loss is dynamically set at 6×ATR from the entry price. This adapts to market volatility and is recalculated every bar — effectively acting as a trailing stop.
Exit Logic: There is no fixed take profit. The trade remains open until the trailing stop is hit — allowing winners to run and losers to be cut quickly.
Risk Management: Each trade risks 0.5% of total equity, ensuring consistent position sizing and capital preservation.
📊 Visual Elements
PSAR dots mark trend direction changes
SMA line shows the broader trend filter
Trailing stop crosses (with 50% opacity) indicate the current stop level without cluttering the chart
⚙️ Customizable Inputs
PSAR parameters: Start, Increment, Maximum
ATR length and multiplier
SMA length
Risk percentage per trade
This strategy is ideal for traders who want to stay aligned with the trend, automate disciplined exits, and avoid emotional decision-making. Clean, simple, and powerful.
Wishing you calm and successful trades!
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.
KONSTANTINOS TROVAS
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.
KONSTANTINOS TROVAS
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.