TEMA 크로스오버 거래 전략

저자:차오장, 날짜: 2023-09-12 16:40:50
태그:

이 전략은 중장기 트렌드를 포착하기 위해 서로 다른 기간의 두 TEMA 라인 사이의 교차를 거래합니다. TEMA는 트렌드 반전을 식별하기 위해 잡음을 잘 필터합니다.

전략 논리:

  1. 빠른 TEMA 라인과 느린 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)

더 많은