주코프의 이동평균 크로스오버 트렌드

저자:차오장, 날짜: 2023-12-12 12:24:11
태그:

img

전반적인 설명

이 전략은 트레이딩 후 자동 트렌드를 구현하기 위해 이동 평균 크로스오버와 ATR 지표를 사용합니다. 빠른 EMA가 느린 EMA를 넘어서면 긴 거리로 이동하고 빠른 EMA가 느린 EMA를 넘어서면 짧은 거리로 이동합니다. 동시에 트렌드 방향을 판단하기 위해 ATR 지표를 사용하여 ATR이 트렌드가 있음을 나타낼 때만 거래 신호를 전송합니다.

전략 논리

이 전략은 주로 두 가지 기술 지표에 기반합니다.

  1. EMA 라인: 빠른 EMA와 느린 EMA의 다른 매개 변수를 가진 두 개의 EMA 라인을 사용합니다. 빠른 EMA가 느린 EMA를 넘으면 긴 신호로 간주됩니다. 빠른 EMA가 느린 EMA를 넘으면 짧은 신호로 간주됩니다.

  2. ATR 지표: ATR 지표는 현재 움직임의 유행성을 판단하기 위해 가격 변동의 규모와 힘을 측정합니다. 작은 ATR 값은 통합을 나타냅니다. 큰 상승 ATR 값은 상승 추세를 나타내고 큰 하락 ATR 값은 하락 추세를 나타냅니다.

EMA 크로스오버를 결합하여 거래 기회를 식별하고 ATR 필터를 결합하여 낮은 트렌드성 제도를 피함으로써 전략은 시장 불황 중에 휘파람을 피하는 것을 목표로합니다.

이점 분석

이 전략의 장점은 다음과 같습니다.

  1. ATR가 트렌드를 파악할 때만 거래합니다. 이는 비방향 체제에서 휘프사이를 피하는 데 도움이 됩니다.

  2. 간단한 빠른 대 느린 EMA 크로스오버 논리를 사용하여 거래 신호를 식별합니다.

  3. 매개 변수 조절을 통해 사용자 정의 가능한 EMA 감수성과 부드러움.

  4. 2개의 간단한 지표로 만들어진 완전한 자동화 거래 시스템입니다. 파인 편집기에서 쉽게 구현됩니다.

  5. 최소한의 필요성, set and forget 접근

위험 분석

주의해야 할 몇 가지 위험 요소는 다음과 같습니다.

  1. EMA 크로스오버는 잘못된 신호를 생성하여 불필요한 손실을 초래할 수 있습니다. 부드러운 EMA 매개 변수는 도움이 될 수 있습니다.

  2. ATR 트렌드 판단 또한 오류가 발생할 수 있으며 거래 기회를 놓칠 수 있습니다. ATR 임계 값은 느려질 수 있습니다.

  3. 더 높은 시간 프레임 기본 요소를 고려하지 않습니다. 주요 뉴스 이벤트는 빠른 EMA 크로스오버가 놓칠 수있는 반전을 유발할 수 있으며 수동 개입이 필요합니다.

이러한 위험은 최적화로 줄일 수 있습니다.

최적화 방향

주요 최적화 방향은 다음과 같습니다.

  1. 결합된 시스템을 만들고 신호 정확도를 향상시키기 위해 다른 지표를 추가합니다. 예를 들어 - 과잉 구매 / 과잉 판매 위험을 피하기 위해 RSI를 통합합니다.

  2. 특정 시장에 더 적합한 EMA 및 ATR 매개 변수를 선택하여 거래 된 기호 및 시간 틀을 기반으로합니다.

  3. 기계 학습을 통해 동적 매개 변수 최적화를 구현하여 고정 정적 값을 사용하는 대신 현재 시장 조건에 따라 지표를 조정합니다.

결론

전체적으로 이것은 전략을 따르는 매우 실용적인 추세이다. 단지 두 가지 지표의 간단한 조합으로 비교적 완전한 거래 시스템을 구축합니다. 매개 변수 조정을 통해 다른 선호도와 스타일을 가진 트레이더에 적응 할 수 있습니다. 동시에 추가 확장 및 최적화는 전략 성능을 더욱 향상시킬 수 있습니다. 간단하지만 효과적인 거래 논리가 강력한 최적화 잠재력과 결합되어 장기적으로 연구하고 적용하는 가치있는 양적 전략입니다.


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

// This strategy has been created for GMT trade 4h by Zhukov


//@version=5
strategy('ZhukovTrade', overlay=true, calc_on_every_tick=true, currency=currency.USD)

// INPUT:

// Options to enter fast and slow Exponential Moving Average (EMA) values
emaFast = input.int(title='Fast EMA', defval=100, minval=1, maxval=9999)
emaSlow = input.int(title='Slow EMA', defval=200, minval=1, maxval=9999)

// Option to select trade directions
tradeDirection = input.string(title='Trade Direction', options=['Long', 'Short', 'Both'], defval='Both')

// Options that configure the backtest date range
startDate = input(title='Start Date', defval=timestamp('01 Jan 2023 00:00'))
endDate = input(title='End Date', defval=timestamp('31 Dec 2023 23:59'))


// CALCULATIONS:

// Use the built-in function to calculate two EMA lines
fastEMA = ta.ema(close, emaFast)
slowEMA = ta.ema(close, emaSlow)
emapos = ta.ema(close,200)

// PLOT:

// Draw the EMA lines on the chart
plot(series=fastEMA, color=color.new(color.orange, 0), linewidth=2)
plot(series=slowEMA, color=color.new(color.blue, 0), linewidth=2)
plot(series=emapos, color=color.new(color.red, 0), linewidth=2)


// CONDITIONS:

// Check if the close time of the current bar falls inside the date range
inDateRange = true

// Translate input into trading conditions
longOK = tradeDirection == 'Long' or tradeDirection == 'Both'
shortOK = tradeDirection == 'Short' or tradeDirection == 'Both'

// Decide if we should go long or short using the built-in functions
longCondition = ta.crossover(fastEMA, slowEMA) 
shortCondition = ta.crossunder(fastEMA, slowEMA) 
// ORDERS:
// Set take profit and stop loss percentages
take_profit_percent = input(0, title="Take Profit Percent")
stop_loss_percent = input(0, title="Stop Loss Percent")
// Submit entry (or reverse) orders


atrPeriod = input(12, "ATR Length")
factor = input.float(3.0, "Factor", step = 0.01)

[supertrend, direction] = ta.supertrend(factor, atrPeriod)

bodyMiddle = plot((open + close) / 2, display=display.none)
upTrend = plot(direction < 0 ? supertrend : na, "Up Trend", color = color.green, style=plot.style_linebr)
downTrend = plot(direction < 0? na : supertrend, "Down Trend", color = color.red, style=plot.style_linebr)

fill(bodyMiddle, upTrend, color.new(color.green, 90), fillgaps=false)
fill(bodyMiddle, downTrend, color.new(color.red, 90), fillgaps=false)

if longCondition and inDateRange 
    if longOK and direction<0

        strategy.entry(id='long', direction=strategy.long, alert_message = "LONG")
if shortCondition and inDateRange 
    if shortOK and direction>0
        strategy.entry(id='short', direction=strategy.short, alert_message = "SHORT")

// Submit exit orders in the cases where we trade only long or only short

if strategy.position_size > 0 and take_profit_percent
    strategy.exit(id='tp long',from_entry ="long",profit = take_profit_percent)
if strategy.position_size > 0 and stop_loss_percent
    strategy.exit(id='sl long',from_entry="long",loss=stop_loss_percent)

if strategy.position_size < 0 and stop_loss_percent
    strategy.exit(id='sl short',from_entry="short",loss=stop_loss_percent)
if strategy.position_size < 0 and take_profit_percent
    strategy.exit(id='tp short',from_entry="short",profit = take_profit_percent)


더 많은