
This strategy is a quantitative trading system based on the crossover of 5-period and 15-period Exponential Moving Averages (EMA). It aims to achieve stable returns while protecting capital through reasonable stop-loss and take-profit levels. The strategy uses classic moving average crossover signals to identify market trend changes and combines them with risk management mechanisms to control the risk-reward ratio of each trade.
The core of the strategy is monitoring the crossover between the fast-moving average (5-period EMA) and the slow-moving average (15-period EMA). A long signal is generated when the 5-period EMA crosses above the 15-period EMA, while a short signal is generated when the 5-period EMA crosses below the 15-period EMA. For each trading signal, the system automatically sets a 1.5% stop-loss level and a 3% take-profit level, ensuring a favorable risk-reward ratio. The stop-loss and take-profit levels are calculated based on the entry price, effectively controlling risk exposure.
This is a well-structured quantitative trading strategy with clear logic. It captures trend reversal points through moving average crossovers and implements risk control with fixed stop-loss and take-profit levels. The strategy is simple to use, suitable for beginners, and provides a good foundation for further optimization. Traders are advised to conduct thorough backtesting before live implementation and optimize parameters according to specific market characteristics.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-11-26 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("5 EMA and 15 EMA Crossover with Stop Loss and Target", overlay=true)
// Define EMAs
ema5 = ta.ema(close, 5)
ema15 = ta.ema(close, 15)
// Plot EMAs on the chart
plot(ema5, title="5 EMA", color=color.blue)
plot(ema15, title="15 EMA", color=color.red)
// Crossover conditions
longCondition = ta.crossover(ema5, ema15)
shortCondition = ta.crossunder(ema5, ema15)
// Stop-loss and take-profit percentage
stopLossPercent = 1.5 // Stop-loss at 1.5%
takeProfitPercent = 3.0 // Take-profit at 3%
// Calculate stop-loss and take-profit levels for long and short positions
longStopLoss = strategy.position_avg_price * (1 - stopLossPercent / 100)
longTakeProfit = strategy.position_avg_price * (1 + takeProfitPercent / 100)
shortStopLoss = strategy.position_avg_price * (1 + stopLossPercent / 100)
shortTakeProfit = strategy.position_avg_price * (1 - takeProfitPercent / 100)
// Enter long position with stop-loss and take-profit
if (longCondition)
strategy.entry("Long", strategy.long)
strategy.exit("Take Profit/Stop Loss", "Long", stop=longStopLoss, limit=longTakeProfit)
// Enter short position with stop-loss and take-profit
if (shortCondition)
strategy.entry("Short", strategy.short)
strategy.exit("Take Profit/Stop Loss", "Short", stop=shortStopLoss, limit=shortTakeProfit)
// Plot stop-loss and take-profit levels
plot(longStopLoss, title="Long Stop Loss", color=color.red, linewidth=1, style=plot.style_linebr)
plot(longTakeProfit, title="Long Take Profit", color=color.green, linewidth=1, style=plot.style_linebr)
plot(shortStopLoss, title="Short Stop Loss", color=color.red, linewidth=1, style=plot.style_linebr)
plot(shortTakeProfit, title="Short Take Profit", color=color.green, linewidth=1, style=plot.style_linebr)