OPEN-SOURCE SCRIPT
SMA Crossover Strategy with TP/SL

📊 Strategy Description: SMA Crossover Strategy with TP/SL
This is a Simple Moving Average (SMA) Crossover Strategy designed to help traders identify trend reversals and manage trades with proper risk-reward logic.
🔹 Entry Logic:
Buy Signal: When the Fast SMA crosses above the Slow SMA → indicating a bullish trend.
Sell Signal: When the Fast SMA crosses below the Slow SMA → indicating a bearish trend.
🔹 Exit Logic:
Take Profit: The strategy exits the position when price reaches a user-defined profit target.
Stop Loss: The trade is closed if price moves against the position beyond the specified stop-loss limit.
⚙️ Parameters:
Fast SMA Length: Number of candles used for fast moving average (default: 10)
Slow SMA Length: Number of candles used for slow moving average (default: 30)
Take Profit (%): Profit target in percentage (default: 0.10%)
Stop Loss (%): Maximum allowed loss per trade (default: 0.10%)
✅ Additional Features:
Strategy backtesting supported
Visual arrows for Buy/Sell signals
Bar coloring based on trend
Alert conditions for Buy/Sell crossover signals
🧠 Suggested Use:
Works best on 1 min, 5 hour, or daily timeframes.
Can be applied to stocks, crypto, forex, or indices.
Ideal for trend-following traders who want automation with risk control.
This is a Simple Moving Average (SMA) Crossover Strategy designed to help traders identify trend reversals and manage trades with proper risk-reward logic.
🔹 Entry Logic:
Buy Signal: When the Fast SMA crosses above the Slow SMA → indicating a bullish trend.
Sell Signal: When the Fast SMA crosses below the Slow SMA → indicating a bearish trend.
🔹 Exit Logic:
Take Profit: The strategy exits the position when price reaches a user-defined profit target.
Stop Loss: The trade is closed if price moves against the position beyond the specified stop-loss limit.
⚙️ Parameters:
Fast SMA Length: Number of candles used for fast moving average (default: 10)
Slow SMA Length: Number of candles used for slow moving average (default: 30)
Take Profit (%): Profit target in percentage (default: 0.10%)
Stop Loss (%): Maximum allowed loss per trade (default: 0.10%)
✅ Additional Features:
Strategy backtesting supported
Visual arrows for Buy/Sell signals
Bar coloring based on trend
Alert conditions for Buy/Sell crossover signals
🧠 Suggested Use:
Works best on 1 min, 5 hour, or daily timeframes.
Can be applied to stocks, crypto, forex, or indices.
Ideal for trend-following traders who want automation with risk control.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。