
This strategy is a trend-following trading system based on the 68-period Exponential Moving Average (EMA) combined with a dynamic stop-loss mechanism. It identifies market trends through price-EMA crossovers while employing initial and trailing stop-losses for risk management, enabling robust trading in trending markets.
The strategy utilizes a 68-period EMA as its core indicator for trend determination. Long positions are initiated when price crosses above the EMA, while short positions are taken when price crosses below. Risk management is implemented through a dual stop-loss mechanism: an initial stop-loss and a trailing stop-loss. The initial stop-loss is set at 20 points from the entry price, and when price moves favorably beyond the initial stop-loss distance, the stop-loss price adjusts by 10 points to lock in partial profits.
Sideways market risk: Frequent stop-losses may be triggered in range-bound markets. Recommended solution: Add trend confirmation indicators like ADX.
Gap risk: Large market gaps may cause actual stop-loss prices to deviate from expected levels. Recommended solution: Consider options hedging or position size adjustment.
Parameter optimization risk: Over-optimization may lead to strategy failure. Recommended solution: Implement out-of-sample testing to ensure parameter stability.
Trend confirmation mechanism: Suggest incorporating trend strength indicators (such as ADX, MACD) to improve trend identification accuracy.
Dynamic parameter adjustment: Automatically adjust EMA period and stop-loss parameters based on market volatility.
Position management optimization: Introduce volatility-based dynamic position sizing system.
Multi-timeframe correlation: Incorporate longer-term trend analysis to improve trade direction accuracy.
This strategy builds a complete trading system by combining EMA trend following with dynamic stop-loss management. Its core strengths lie in clear trading logic and comprehensive risk control mechanisms. Through the suggested optimization directions, the strategy’s stability and profitability can be further enhanced. The strategy is suitable for medium to long-term investors seeking steady returns.
/*backtest
start: 2024-10-01 00:00:00
end: 2025-02-18 08:00:00
period: 2d
basePeriod: 2d
exchanges: [{"eid":"Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("EMA 68 with Trailing Stop-Loss", overlay=true)
// Inputs for customization
length_ema = input(68, title="EMA Length")
initial_stop_loss_points = input(20, title="Initial Stop Loss in Points")
trail_distance = input(10, title="Trailing Stop Adjustment in Points")
ema68 = ta.ema(close, length_ema)
// Plot EMA
plot(ema68, color=color.blue, title="68-Day EMA")
var float entry_price = na // Store entry price
var bool is_long = false // Track if we are in a long trade
var bool is_short = false // Track if we are in a short trade
// Buy Condition: Close above 68-day EMA
if ta.crossover(close, ema68)
strategy.entry("Long", strategy.long)
entry_price := close
is_long := true
is_short := false
// Sell Condition: Close below 68-day EMA
if ta.crossunder(close, ema68)
strategy.entry("Short", strategy.short)
entry_price := close
is_long := false
is_short := true
// Long Exit Conditions
if is_long
stop_loss = entry_price - initial_stop_loss_points
trail_price = entry_price + initial_stop_loss_points
if close >= trail_price
stop_loss := entry_price + trail_distance
strategy.exit("LongExit", "Long", stop=stop_loss, when=close < ema68)
// Short Exit Conditions
if is_short
stop_loss = entry_price + initial_stop_loss_points
trail_price = entry_price - initial_stop_loss_points
if close <= trail_price
stop_loss := entry_price - trail_distance
strategy.exit("ShortExit", "Short", stop=stop_loss, when=close > ema68)