OPEN-SOURCE SCRIPT
atr stop loss for double SMA v6

Strategy Name
atr stop loss for double SMA v6
Credit: This v6 update is based on Daveatt’s “BEST ATR Stop Multiple Strategy.”
Core Logic
Entry: Go long when the 15-period SMA crosses above the 45-period SMA; go short on the inverse cross.
Stop-Loss: On entry, compute ATR(14)×2.0 and set a fixed stop at entry ± that amount. Stop remains static until hit.
Trend Tracking: Uses barssince() to ensure only one active long or short position; stop is only active while that trend persists.
Visualization
Plots fast/slow SMA lines in teal/orange.
On each entry bar, displays a label showing “ATR value” and “ATR×multiple” positioned at the 30-bar low (long) or high (short).
Draws an “×” at the stop-price level in green (long) or red (short) while the position is open.
Execution Settings
Initial Capital: $100 000, Size = 100 shares per trade.
Commission: 0.075% per trade.
Pyramiding: 1.
Calculations: Only on bar close (no intra-bar ticks).
Usage Notes
Static ATR stop adapts to volatility but does not trail.
Ideal for trending, liquid markets (stocks, futures, FX).
Adjust SMA lengths or ATR multiple for faster/slower signals.
atr stop loss for double SMA v6
Credit: This v6 update is based on Daveatt’s “BEST ATR Stop Multiple Strategy.”
Core Logic
Entry: Go long when the 15-period SMA crosses above the 45-period SMA; go short on the inverse cross.
Stop-Loss: On entry, compute ATR(14)×2.0 and set a fixed stop at entry ± that amount. Stop remains static until hit.
Trend Tracking: Uses barssince() to ensure only one active long or short position; stop is only active while that trend persists.
Visualization
Plots fast/slow SMA lines in teal/orange.
On each entry bar, displays a label showing “ATR value” and “ATR×multiple” positioned at the 30-bar low (long) or high (short).
Draws an “×” at the stop-price level in green (long) or red (short) while the position is open.
Execution Settings
Initial Capital: $100 000, Size = 100 shares per trade.
Commission: 0.075% per trade.
Pyramiding: 1.
Calculations: Only on bar close (no intra-bar ticks).
Usage Notes
Static ATR stop adapts to volatility but does not trail.
Ideal for trending, liquid markets (stocks, futures, FX).
Adjust SMA lengths or ATR multiple for faster/slower signals.
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.