
이 전략은 TEMA(Triple Exponential Moving Average)를 기반으로 한 추세 추종 거래 시스템입니다. 이 전략은 단기 및 장기 TEMA의 교차 신호를 비교하여 시장 동향을 파악하고 변동성 정지를 결합하여 위험을 관리합니다. 이 전략은 5분 기간으로 실행되며 300주기와 500주기 TEMA 지표를 신호 생성의 기준으로 사용합니다.
전략의 핵심 논리는 다음과 같은 핵심 요소에 기초합니다.
이 전략은 TEMA 지표의 교차를 통해 추세를 포착하고 동적 손절매로 위험을 관리하는 완전한 추세 추적 시스템입니다. 이 전략은 논리성이 명확하고, 구현이 간단하며, 실용성이 좋습니다. 하지만 실제 거래에서는 시장 환경의 식별과 위험 관리에 주의를 기울여야 합니다. 백테스팅 검증을 기반으로 실제 시장 상황에 따라 매개변수를 최적화하는 것이 좋습니다.
/*backtest
start: 2019-12-23 08:00:00
end: 2025-01-04 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=6
strategy("TEMA Strategy for Gold", overlay=true)
// Inputs
tema_short_length = input.int(300, title="Short TEMA Length")
tema_long_length = input.int(500, title="Long TEMA Length")
pip_value = input.float(0.10, title="Pip Value (10 pips = 1 point for Gold)")
// Calculate TEMA
tema_short = ta.ema(2 * ta.ema(close, tema_short_length) - ta.ema(ta.ema(close, tema_short_length), tema_short_length), tema_short_length)
tema_long = ta.ema(2 * ta.ema(close, tema_long_length) - ta.ema(ta.ema(close, tema_long_length), tema_long_length), tema_long_length)
// Plot TEMA
plot(tema_short, color=color.blue, title="300 TEMA")
plot(tema_long, color=color.red, title="500 TEMA")
// Crossover conditions
long_condition = ta.crossover(tema_short, tema_long)
short_condition = ta.crossunder(tema_short, tema_long)
// Calculate recent swing high/low
swing_low = ta.lowest(low, 10)
swing_high = ta.highest(high, 10)
// Convert pips to price
pip_adjustment = pip_value * syminfo.mintick
// Long entry logic
if (long_condition and strategy.position_size == 0)
stop_loss_long = swing_low - pip_adjustment
strategy.entry("Long", strategy.long)
label.new(bar_index, swing_low, style=label.style_label_down, text="Buy", color=color.green)
// Short entry logic
if (short_condition and strategy.position_size == 0)
stop_loss_short = swing_high + pip_adjustment
strategy.entry("Short", strategy.short)
label.new(bar_index, swing_high, style=label.style_label_up, text="Sell", color=color.red)
// Exit logic
if (strategy.position_size > 0 and short_condition)
strategy.close("Long")
label.new(bar_index, high, style=label.style_label_up, text="Exit Long", color=color.red)
if (strategy.position_size < 0 and long_condition)
strategy.close("Short")
label.new(bar_index, low, style=label.style_label_down, text="Exit Short", color=color.green)