TEMA移動平均クロスオーバー取引戦略


作成日: 2023-09-12 16:40:50 最終変更日: 2023-09-12 16:40:50
コピー: 1 クリック数: 721
1
フォロー
1617
フォロワー

この戦略は,2つの異なる周期のTEMA指標を交差して取引し,中間周期の価格傾向を捉えます.TEMA指標は価格のノイズを効果的にフィルターし,トレンドの逆転を認識します.

戦略の原則:

  1. 順番に2つのTEMA平均線を計算する.典型的なパラメータは,速線5周期,緩線8周期である.

  2. スローラインが下から突破すると,複数の操作を行う.

  3. 快線が上から下から遅線を突破すると,空白平仓操作を行う.

  4. K線実体方向によるフィルタリングを選択し,反転取引を避ける.

  5. 逆転周期を設定し,過去の取引シグナルを模擬する.

この戦略の利点は

  1. TEMA指標は価格騒音のフィルタリングに優れています.

  2. TEMAは中期トレンドを捉えるため,迅速に協力しています.

  3. 方向フィルタリングは逆転を回避し,勝負の確率を高めます.

この戦略のリスクは

  1. TEMAは遅滞の問題を抱えており,最高の入場時間を逃している可能性があります.

  2. パラメータの組み合わせを最適化して最適のマッチングを達成する必要があります.

  3. 震災が起きたMusikschuleでは,信号が持続できません.

要するに,この戦略は2つの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)