This is a trading strategy based on the crossover of 15-period and 50-period Exponential Moving Averages (EMA). The strategy implements intelligent stop-loss and take-profit levels to optimize risk-reward control. It not only captures trend reversal signals but also automatically adjusts trading parameters based on market volatility, thereby improving strategy stability and profitability.
The core logic is based on crossover signals between the fast EMA (15-period) and slow EMA (50-period). A long signal is generated when the fast line crosses above the slow line, and a short signal when the fast line crosses below. For risk management optimization, the strategy employs a dynamic stop-loss setting method, using the lowest opening price of the previous 2 candles as the long stop-loss and the highest opening price as the short stop-loss. The profit target is set at twice the risk, ensuring a favorable risk-reward ratio. The strategy uses 30% of the account equity for trading, which helps control risk exposure.
This is a well-structured EMA crossover strategy with clear logic. By combining classical technical analysis methods with modern risk management techniques, the strategy achieves favorable risk-reward characteristics. While there is room for optimization, the basic framework demonstrates good practicality and extensibility. Through the suggested optimization directions, the strategy’s performance can be further enhanced.
/*backtest start: 2019-12-23 08:00:00 end: 2024-12-11 08:00:00 period: 1d basePeriod: 1d exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("EMA Cross - Any Direction", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=30) // Input for EMAs ema_short_length = input(15, title="Short EMA Length") ema_long_length = input(50, title="Long EMA Length") // Calculate EMAs ema_short = ta.ema(close, ema_short_length) ema_long = ta.ema(close, ema_long_length) // Plot EMAs plot(ema_short, color=color.blue, title="15 EMA") plot(ema_long, color=color.red, title="50 EMA") // Entry Conditions (Any EMA Cross) cross_condition = ta.crossover(ema_short, ema_long) or ta.crossunder(ema_short, ema_long) // Determine Trade Direction is_long = ta.crossover(ema_short, ema_long) is_short = ta.crossunder(ema_short, ema_long) // Stop Loss and Take Profit long_stop_loss = ta.lowest(open[1], 2) // Lowest open of the last 2 candles short_stop_loss = ta.highest(open[1], 2) // Highest open of the last 2 candles long_take_profit = close + 2 * (close - long_stop_loss) short_take_profit = close - 2 * (short_stop_loss - close) // Execute Trades if (cross_condition) if (is_long) strategy.entry("Long", strategy.long) strategy.exit("Exit Long", "Long", stop=long_stop_loss, limit=long_take_profit) else if (is_short) strategy.entry("Short", strategy.short) strategy.exit("Exit Short", "Short", stop=short_stop_loss, limit=short_take_profit) // Plot Stop Loss and Take Profit Levels plot(long_stop_loss, color=color.orange, title="Long Stop Loss", style=plot.style_circles, linewidth=2) plot(long_take_profit, color=color.green, title="Long Take Profit", style=plot.style_circles, linewidth=2) plot(short_stop_loss, color=color.orange, title="Short Stop Loss", style=plot.style_circles, linewidth=2) plot(short_take_profit, color=color.red, title="Short Take Profit", style=plot.style_circles, linewidth=2)