
この戦略は,均線交差信号とトレンドフィルターに基づいた取引システムである.短期SMA ((9サイクルと15サイクル) の交差信号と長期EMA ((200サイクル) の交差信号をトレンドフィルターとして組み合わせて,異なる時間周期の均線交差によって市場トレンドを捉える.システムには,トレンドが継続するときに再入場するメカニズムが含まれている.
戦略は,三重均線システムで取引決定を行います.
この戦略は,複数の均線システムとトレンドフィルターを組み合わせて,完全なトレンド追跡取引システムを構築する.その主な優点は,強いトレンド市場で有意な収益を得ることができ,同時に均線フィルターと再入場メカニズムによってシステムの安定性を高めることです.いくつかの固有のリスクがあるものの,最適化方向の実施によって戦略のパフォーマンスをさらに向上させることができます.この戦略は,中長期の市場傾向を追跡するのに適しており,忍耐強いトレーダーにとって信頼性の高い取引ツールです.
/*backtest
start: 2024-02-19 00:00:00
end: 2025-02-17 00:00:00
period: 1h
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("SMA Crossover with EMA Filter", overlay=true)
// Define indicators
sma9 = ta.sma(close, 9)
sma15 = ta.sma(close, 15)
ema200 = ta.ema(close, 200)
// Crossover conditions
bullish_crossover = ta.crossover(sma9, sma15) // Buy signal
bearish_crossover = ta.crossunder(sma9, sma15) // Sell signal
// Filters
above_ema200 = close > ema200
below_ema200 = close < ema200
// Buy condition (only above 200 EMA)
buy_signal = bullish_crossover and above_ema200
if buy_signal
strategy.entry("Buy", strategy.long)
// Sell condition (only below 200 EMA)
sell_signal = bearish_crossover and below_ema200
if sell_signal
strategy.entry("Sell", strategy.short)
// Exit condition if the signal reverses
exit_long = bearish_crossover
exit_short = bullish_crossover
if exit_long
strategy.close("Buy")
if exit_short
strategy.close("Sell")
// Re-entry condition when price crosses EMA 200 after a prior crossover
buy_reentry = ta.barssince(bullish_crossover) > 0 and above_ema200
sell_reentry = ta.barssince(bearish_crossover) > 0 and below_ema200
if buy_reentry
strategy.entry("Buy", strategy.long)
if sell_reentry
strategy.entry("Sell", strategy.short)
// Plot indicators
plot(sma9, color=color.blue, title="SMA 9")
plot(sma15, color=color.red, title="SMA 15")
plot(ema200, color=color.orange, title="EMA 200")