Strategy vault / Trend following
SMA Crossover Trading Strategy
SMA Crossover Trading Strategy This strategy generates trading signals based on crossover between two SMA lines of different periods. A long signal is triggered when the faster SMA crosses above the slower SMA. A…
SMA Crossover Trading Strategy
This strategy generates trading signals based on crossover between two SMA lines of different periods. A long signal is triggered when the faster SMA crosses above the slower SMA. A short signal occurs when the faster SMA crosses below the slower SMA.
Some key benefits of this strategy:
- Identifies trend changes using SMA crossovers
- Simple and straightforward rules
- Customizable SMA periods for optimization
- Applicable for any timeframe
However, some potential limitations exist:
- Prone to false signals during range-bound markets
- Lagging signals, late entry timing
- No stop loss, can lead to large drawdowns
- Lack of filters, uncontrolled signal quality
Some ways to enhance the strategy:
- Add stop loss when price touches slower SMA
- Scale in based on bull/bear candle closes
- Optimize SMA period combinations
- Adjust position sizing and risk management
Overall, the SMA crossover method works well in trending markets but must be traded cautiously during choppy periods. Incorporating stop loss and proper risk management can reduce downside risks.
Source Pine Script
/*backtest
start: 2023-08-11 00:00:00
end: 2023-09-10 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy("SMA Crossover demo", overlay=true)
shortCondition = crossover(sma(close, 34), sma(close, 4))
if (shortCondition)
strategy.entry("Sell/Short", strategy.short)
longCondition = crossunder(sma(close, 34), sma(close, 4))
if (longCondition)
strategy.entry("Buy/Long", strategy.long)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-09-11. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/SMA-Crossover-Trading-Strategy.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ADX MA and EMA Long Only Trend Tracking StrategyPine Script · Trend following · 1d
- ATR and Moving Average Crossover Hybrid StrategyPine Script · Trend following · 1h
- Adaptive FVG Detection and MA Trend Trading Strategy with Dynamic ResistancePine Script · Trend following · 1d
- Adaptive Risk Management Strategy Based on Dynamic ATR and Moving Average CrossoverPine Script · Trend following · 2h
- Adaptive Trading Strategy Based on Stochastic RSI Dual Line CrossoverPine Script · Trend following · 4h
- Adaptive Volatility Based Trend Following Short Strategy with Time Delay and Stop Loss ProtectionPine Script · Trend following · 2m