TEMAのクロスオーバー取引戦略

作者: リン・ハーンチャオチャン開催日:2023年9月12日 16時40分50秒
タグ:

この戦略は,中期トレンドを把握するために,異なる時期の2つのTEMA線間のクロスオーバーを交換する.TEMAはトレンド逆転を特定するためにノイズをよくフィルターする.

戦略論理:

  1. 速くて遅いTEMA線を計算します 通常は5~8周期です

  2. 速いTEMAが遅いTEMAを 越える時に長走する

  3. 速度のTEMAが 遅いTEMAを下回ると 長い出口です

  4. 逆動向の取引を避けるため,キャンドル方向に基づいてフィルタリングするオプション.

  5. 過去の信号をシミュレートするために 指定された期間におけるバックテスト

利点:

  1. TEMAは価格騒音を 強くフィルターします

  2. スピード/スローコンボは中間トレンドを捉えています

  3. 方向フィルターは逆トレンドエントリを避けることで 勝利率を向上させます

リスク:

  1. TEMAはまだ遅れている 恐らく最高のエントリーが欠けている

  2. パラメータ調整が理想のマッチに必要だ

  3. 信号を維持するのは難しい

要約すると,この戦略は,安定性のためにノイズフィルタリングを伴うトレンドトレンドに TEMAラインを横切ります. しかし,TEMA遅延は持続し,市場のペースに合わせて最適化が必要です.


/*backtest
start: 2022-09-11 00:00:00
end: 2023-09-11 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
strategy("Tema",overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100, commission_type=strategy.commission.percent, commission_value=0.075)
startP = timestamp(input(2017, "Start Year"), input(12, "Start Month"), input(17, "Start Day"), 0, 0)
end   = timestamp(input(9999, "End Year"),   input(1, "End Month"),   input(1, "End Day"),   0, 0)
_testPeriod() =>
    iff(time >= startP and time <= end, true, false)

tema_length_1 = input(5, "Fast TEMA")
tema_length_2 = input(8, "Slow TEMA")
usedir       = input(true, "Use bar's direction ?" )
dirtime      = input(2,"direction bars")

tema(sec, length)=>
    tema1= ema(sec, length)
    tema2= ema(tema1, length)
    tema3= ema(tema2, length)
    tema = 3*tema1-3*tema2+tema3

tema1 = tema(hlc3, tema_length_1)
tema2 = tema(hlc3, tema_length_2)

dir=if close/close[dirtime] > 1
    1
else
    -1

plot(tema1, color=color.green, transp=50)
plot(tema2, color=color.red, transp=50)


up =  crossover(tema1, tema2) 
down = crossunder(tema1, tema2)

long_condition =  up and (usedir ? dir==1 : true) and _testPeriod()
strategy.entry('BUY', strategy.long, when=long_condition)  
 
short_condition =  down
strategy.close('BUY', when=short_condition)

もっと