
この戦略は,3つの異なる周期の指数移動平均 ((EMA) を使って市場トレンドと買い物シグナルを判断する.急速EMA,遅いEMAとトレンドフィルターEMAの交差,そしてトレンドフィルターEMAの相対の価格の位置が,戦略の核心的な論理を構成する.また,この戦略は,Fukuizトレンド指標を補助的な判断として導入し,場合によっては平仓操作を誘発する.
この戦略は,複数の周期EMAの組み合わせとFukuizトレンド指標の補助により,比較的完全なトレンド判断と取引の枠組みを構築している.戦略の論理は明確で,パラメータは調整可能で,適応性が強い.しかしながら,信号遅延,トレンド判断偏差などの潜在的なリスクもあります.将来,パラメータ最適化,指標組み合わせ,リスク管理などの面で戦略をさらに完善することができます.
/*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")