OPEN-SOURCE SCRIPT

SMA Crossover Strategy with TP/SL

230
📊 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.

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。