
Chiến lược này sử dụng moving average chỉ số ((EMA) của ba chu kỳ khác nhau để đánh giá xu hướng thị trường và tín hiệu mua và bán. Sự giao thoa của EMA nhanh, EMA chậm và EMA lọc xu hướng, và vị trí của giá so với EMA lọc xu hướng, cùng nhau tạo thành logic cốt lõi của chiến lược.
Chiến lược này được xây dựng bằng sự kết hợp của nhiều EMA chu kỳ, và hỗ trợ của chỉ số xu hướng Fukuiz, để xây dựng một khung phán đoán và giao dịch xu hướng tương đối hoàn chỉnh. Lập luận của chiến lược là rõ ràng, các tham số có thể điều chỉnh được, có khả năng thích ứng mạnh mẽ. Tuy nhiên, cũng có một số rủi ro tiềm ẩn, chẳng hạn như tín hiệu chậm trễ, sai lệch trong phán đoán xu hướng.
/*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")