This strategy uses three exponential moving averages (EMAs) with different periods to determine market trends and generate buy/sell signals. The crossovers between the fast EMA, slow EMA, and trend filter EMA, along with the price position relative to the trend filter EMA, form the core logic of this strategy. Additionally, the Fukuiz trend indicator is introduced as an auxiliary judgment, which triggers position closing under certain conditions.
This strategy constructs a relatively complete trend judgment and trading framework by combining multiple-period EMAs and the Fukuiz trend indicator. The strategy logic is clear, the parameters are adjustable, and the adaptability is strong. However, it also has some potential risks, such as signal lag and trend judgment deviation. In the future, the strategy can be further refined in terms of parameter optimization, indicator combination, and risk management.
/*backtest start: 2023-06-08 00:00:00 end: 2024-06-13 00:00:00 period: 1d basePeriod: 1h exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}] */ //@version=5 strategy("EvilRed Trading Indicator Trend Filter", overlay=true) // Parameters Definition fastLength = input(9, title="Fast EMA Length") slowLength = input(21, title="Slow EMA Length") trendFilterLength = input(200, title="Trend Filter EMA Length") // Moving Averages Calculation fastEMA = ta.ema(close, fastLength) slowEMA = ta.ema(close, slowLength) trendEMA = ta.ema(close, trendFilterLength) // Volatility Calculation volatility = ta.stdev(close, 20) // Add Fukuiz Trend Indicator fukuizTrend = ta.ema(close, 14) fukuizColor = fukuizTrend > fukuizTrend[1] ? color.green : color.red plot(fukuizTrend, color=fukuizColor, title="Fukuiz Trend") // Plotting Moving Averages plot(fastEMA, color=color.blue, title="Fast EMA") plot(slowEMA, color=color.red, title="Slow EMA") plot(trendEMA, color=color.orange, title="Trend Filter") // Plotting Buy and Sell Signals buySignal = ta.crossover(fastEMA, slowEMA) and fastEMA > slowEMA and close > trendEMA sellSignal = ta.crossunder(fastEMA, slowEMA) and fastEMA < slowEMA and close < trendEMA // Entry and Exit Conditions if (strategy.position_size > 0 and fukuizColor == color.red) strategy.close("Long", comment="Fukuiz Trend is Red") if (strategy.position_size < 0 and fukuizColor == color.green) strategy.close("Short", comment="Fukuiz Trend is Green") if (buySignal) strategy.entry("Long", strategy.long) if (sellSignal) strategy.entry("Short", strategy.short) plotshape(buySignal, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal") plotshape(sellSignal, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")