
이 전략은 시장의 추세와 매매 신호를 판단하기 위해 3개의 다른 주기의 지수 이동 평균 ((EMA) 을 사용한다. 빠른 EMA, 느린 EMA 및 추세 필터 EMA의 교차, 그리고 추세 필터 EMA에 대한 가격의 위치가 전략의 핵심 논리를 구성한다. 이 전략은 또한 후쿠이즈 추세 지표를 보조 판단으로 도입하여 경우에 따라 평형 포지션을 유발한다.
이 전략은 여러 주기적 EMA의 조합과 후쿠이즈 트렌드 지표의 보조를 통해 비교적 완전한 트렌드 판단과 거래 프레임워크를 구축한다. 전략 논리는 명확하고, 매개 변수는 조정 가능하며, 적응력이 강하다. 그러나 동시에 신호 지연, 트렌드 판단 편차 등과 같은 몇 가지 잠재적인 위험도 존재한다.
/*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")