4倍EMA指標の取引戦略

作者: リン・ハーンチャオチャン,日付: 2023-09-12 14:51:28
タグ:

この戦略は,異なるパラメータを持つ4つのEMAラインを使用して,機械取引のための明確なトレンドフォローシステムを形成する.この戦略は,二重EMAクロスオーバー方法を使用して中長期トレンドを追跡することを目的としています.

戦略論理:

  1. 2つの速いEMAと遅いEMAペアを計算します.通常は72期と44期です.

  2. 高速EMAが低速EMAを横切るとロングになります

  3. 速いEMAが遅いEMAを下回るとショートする.

  4. 購入・販売のシグナルを色で表示する.

  5. シグナルを実行するために指定された期間中にバックテストする.

利点:

  1. 4つのEMAは明確なトレンドパターンを形成します

  2. 急速/遅いEMAコンボは,中長期のトレンドを効果的に追跡します.

  3. クロスオーバーのルールは単純で 過度な取引を避けるのです

リスク:

  1. EMAの遅延は,トレンドの転換を逃す可能性があります.

  2. ストップなしの取引は 単一の取引で無制限の損失を意味します

  3. 悪いパラメータは過剰な信号や不一致を引き起こす可能性があります.

概要すると,四重EMAクロスオーバー戦略は,機械的なトレンド取引のために高速/遅いEMAペアを使用する.視覚的なトレーダーにとって視覚的なインターフェースは直感的です.しかし,遅延とストップの欠如は,長期的な安定した利益のために慎重なリスク管理が依然として必要であることを意味します.


/*backtest
start: 2023-08-12 00:00:00
end: 2023-09-11 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// strategy(title = "Cuathro EMA Strategy", shorttitle = "Cuathro EMA",initial_capital=1000, commission_value=0.2, commission_type =strategy.commission.percent, default_qty_value=100 , overlay = false, pyramiding=10, default_qty_type=strategy.percent_of_equity)
//@Moneros 2017
// based on OCC by @JayRogers
emaSlowPeriod    = input(defval = 44, title = "EMA Slow, always < EMA Fast - low short term, high long term ", minval = 1)
emaFastPeriod    = input(defval = 72, title = "EMA Fast - low short term, high long term ", minval = 1)
len    = input(defval = 14, title = "Period", minval = 1)
res = input(title="Resolution  - not lower than chart", defval="120")



closeSeries =  request.security(syminfo.tickerid, res, 2 * ta.ema(close, len) - ta.ema(ta.ema(close, len), len)  )
openSeries  = request.security(syminfo.tickerid,res, 2 * ta.ema(close[1], len) - ta.ema(ta.ema(close[1], len), len)  )


slowema = ta.ema(closeSeries - openSeries,emaSlowPeriod)
fastema = ta.ema(closeSeries - openSeries,emaFastPeriod)

plot(slowema, color=color.blue)
plot(fastema,color=color.red)


bgcolor(slowema< fastema ? color.red : na, transp=90)
bgcolor(slowema> fastema ? color.blue : na, transp=90)

bgcolor(ta.crossover(slowema, fastema) ? color.blue : na, transp=40)
bgcolor(ta.crossunder(slowema, fastema) ? color.red : na, transp=40)
strategy.order("BUY", strategy.long, 1, when = ta.crossover(slowema, fastema))
strategy.order("SELL", strategy.short, 1, when = ta.crossunder(slowema, fastema)) 


もっと