This is a dual moving average crossover strategy based on the SuperTrend indicator. SuperTrend consists of two moving averages, their crossover acts as buy and sell signals. The strategy belongs to the trend following category.
Calculate the fast line demaFast, formula: 2*ema5 - ema(ema5,5)
Calculate the slow line demaSlow, formula: 2*ema2 - ema(ema2,2)
The fast line consists of 5-day EMA, more responsive to price changes; the slow line consists of 2-day EMA, lagging in response.
When fast line crosses above slow line from below, generate buy signal; when crossing below from above, generate sell signal.
Using crossover of two lines with different response speeds to determine trend change is a typical trend following strategy.
Execute trades based on buy and sell signals.
The core logic is simple and clear. By adjusting the MA parameters it can adapt to different cycle markets, a common trend following strategy.
Using dual MA crossover to determine trend change is a simple and practical technique.
Fast and slow line parameters are adjustable for optimizing different periods.
Clear signals and simple execution.
Complete backtest functionality to verify strategy.
Intuitive visual interface showing crossover.
Easy to understand logic, suitable for beginners.
Dual MA crossover may have lagging signals or false signals. Can improve by adjusting parameters or adding filters.
Ineffective in range-bound or choppy markets, prone to stop loss. Can add trend mechanism.
Limited optimization space in backtest, real trading effect untested.
Need to watch transaction cost impact on profitability.
Test different MA length combinations to find optimal match.
Add other indicators for signal filtering, e.g. KDJ.
Add stop loss mechanism to control single trade loss amount.
Add position sizing to use different percentages for different market conditions.
Optimize money management, set risk metrics like profit ratio.
Consider machine learning algorithms for parameter optimization or signal forecasting.
This SuperTrend dual MA strategy is a simple trend following system adaptable to different cycles. Combining with other technical indicators and risk control can further enhance stability. Easy to learn with great potential for expansions, it is a highly practical quant trading strategy.
/*backtest start: 2023-01-01 00:00:00 end: 2023-09-18 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ strategy(title = "SuperTrend", shorttitle = "BTC") ema5=ta.ema(close, 5) ema2=ta.ema(close, 2) demaFast = request.security(syminfo.tickerid, "30", 2 * ema5 - ta.ema(ema5, 5) ) plotchar((2 * ema5 - ta.ema(ema5, 5)), "d", "", location = location.top) plotchar(demaFast, "fast", "", location = location.top) demaSlow = request.security(syminfo.tickerid,"30", 2 * ema2 - ta.ema(ema2, 2) ) plotchar(demaSlow, "slow", "", location = location.top) buy = ta.crossover(demaSlow, demaFast) sell = ta.crossunder(demaSlow, demaFast) strategy.entry("BUY", strategy.long, 1, when = buy) strategy.entry("SELL", strategy.short, 1, when = sell )