OPEN-SOURCE SCRIPT
Simple SMA Strategy

This strategy uses two Simple Moving Averages (SMAs) to spot trend changes and generate trade signals on any market or timeframe.
How it works:
➡️ Long Entry: When the fast SMA (default 14) crosses above the slow SMA (default 28), enter a long position.
⬇️ Short Entry: When the fast SMA crosses below the slow SMA, enter a short position.
🔄 Exit: Positions close when the opposite crossover happens, capturing trend reversals.
Features:
⚙️ Adjustable SMA lengths for different markets or styles
💰 Position sizing as % of equity (default 1%) for risk management
📊 Plots fast (blue) and slow (orange) SMAs on the chart
🔔 Alerts on every long & short entry crossover for automation or notifications
Use Cases:
Perfect for trend-following traders in crypto, stocks, forex, and more — simple and effective.
⚠️ Disclaimer
Backtests and alerts are based on historical data and don’t guarantee future results. Always test carefully and manage your risk!
How it works:
➡️ Long Entry: When the fast SMA (default 14) crosses above the slow SMA (default 28), enter a long position.
⬇️ Short Entry: When the fast SMA crosses below the slow SMA, enter a short position.
🔄 Exit: Positions close when the opposite crossover happens, capturing trend reversals.
Features:
⚙️ Adjustable SMA lengths for different markets or styles
💰 Position sizing as % of equity (default 1%) for risk management
📊 Plots fast (blue) and slow (orange) SMAs on the chart
🔔 Alerts on every long & short entry crossover for automation or notifications
Use Cases:
Perfect for trend-following traders in crypto, stocks, forex, and more — simple and effective.
⚠️ Disclaimer
Backtests and alerts are based on historical data and don’t guarantee future results. Always test carefully and manage your risk!
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.