多要素定量取引戦略.この戦略は,均線因子と振動指標因子を総合的に考慮して,リスクを制御し,安定性を高める.この記事では,この取引戦略の原理,利点,および潜在的なリスクについて詳しく説明する.
この戦略は以下の3つのモジュールから構成されています.
5つの異なる周期のEMA平均線 ((8,13,21,34,55日) を使ってトレンドフィルターを構築する.平均線は短期から長期まで並べられ,短期平均線が長期平均線を横切るときにのみトレンド特性を有し,取引信号を生成する.
RSIとストキャスティック2つの振動指標を組み合わせて,突破を検証し,振動的な市場で大量に偽突破を避ける.
RSIのパラメータは14で,RSIは40-70の範囲で多行条件に適合し,30-60の範囲で空行条件に適合する.
ストキャスティックパラメータは ((14,3,3),K線が20-80の範囲で多条件に適合し,5-95の範囲で空条件に適合する.
均線因子と振動指標因子が同時に条件を満たしている場合にのみ,入場信号が誘発される.いずれかの因子が条件を満たしていない場合に,出場信号が生成される.
戦略全体は厳格な多要素フィルターメカニズムを採用し,高い勝率を維持しながら,取引信号の安定性と信頼性を確保しています.
この戦略は,トレンドフォローと反転取引の優位性を成功的に融合させ,多要素モデルがリスクを効果的に制御し,安定した超利益を得ることができます.これは非常に実用的な量化取引戦略モデルであり,AIコミュニティの深入な研究と適用に値します.
/*backtest
start: 2022-09-12 00:00:00
end: 2022-11-15 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=3
strategy(title = "Combined Strategy", default_qty_type = strategy.percent_of_equity, default_qty_value = 100, commission_type=strategy.commission.percent, commission_value = .0020, pyramiding = 0, slippage = 3, overlay = true)
//----------//
// MOMENTUM //
//----------//
ema8 = ema(close, 8)
ema13 = ema(close, 13)
ema21 = ema(close, 21)
ema34 = ema(close, 34)
ema55 = ema(close, 55)
plot(ema8, color=red, style=line, title="8", linewidth=1)
plot(ema13, color=orange, style=line, title="13", linewidth=1)
plot(ema21, color=yellow, style=line, title="21", linewidth=1)
plot(ema34, color=aqua, style=line, title="34", linewidth=1)
plot(ema55, color=lime, style=line, title="55", linewidth=1)
longEmaCondition = ema8 > ema13 and ema13 > ema21 and ema21 > ema34 and ema34 > ema55
exitLongEmaCondition = ema13 < ema55
shortEmaCondition = ema8 < ema13 and ema13 < ema21 and ema21 < ema34 and ema34 < ema55
exitShortEmaCondition = ema13 > ema55
// ---------- //
// OSCILLATORS //
// ----------- //
rsi = rsi(close, 14)
longRsiCondition = rsi < 70 and rsi > 40
exitLongRsiCondition = rsi > 70
shortRsiCondition = rsi > 30 and rsi < 60
exitShortRsiCondition = rsi < 30
// Stochastic
length = 14, smoothK = 3, smoothD = 3
kFast = stoch(close, high, low, 14)
dSlow = sma(kFast, smoothD)
longStochasticCondition = kFast < 80
exitLongStochasticCondition = kFast > 95
shortStochasticCondition = kFast > 20
exitShortStochasticCondition = kFast < 5
//----------//
// STRATEGY //
//----------//
longCondition = longEmaCondition and longRsiCondition and longStochasticCondition and strategy.position_size == 0
exitLongCondition = (exitLongEmaCondition or exitLongRsiCondition or exitLongStochasticCondition) and strategy.position_size > 0
if (longCondition)
strategy.entry("LONG", strategy.long)
if (exitLongCondition)
strategy.close("LONG")
shortCondition = shortEmaCondition and shortRsiCondition and shortStochasticCondition and strategy.position_size == 0
exitShortCondition = (exitShortEmaCondition or exitShortRsiCondition or exitShortStochasticCondition) and strategy.position_size < 0
if (shortCondition)
strategy.entry("SHORT", strategy.short)
if (exitShortCondition)
strategy.close("SHORT")