EMA 기울기 및 트렌드 트레이딩 전략

저자:차오장, 날짜: 2023-09-20 14:32:22
태그:

전반적인 설명

이 전략은 동향 방향을 결정하기 위해 여러 EMA 사이의 기울기 방향과 교차 관계를 사용합니다.

전략 논리

  1. EMA의 3개의 그룹을 계산합니다. 빠른 EMA, 중간 EMA 및 느린 EMA.

  2. 빠른 EMA가 중간 EMA를 넘어서고 중간 EMA 기울기가 양으로 변하면 긴 신호가 생성됩니다.

  3. 빠른 EMA가 중간 EMA 아래로 넘어가고 중간 EMA 기울기가 음으로 변하면 짧은 신호가 생성됩니다.

  4. 가격이 느린 EMA를 넘어서면 롱하고, 가격이 느린 EMA를 넘어서면 쇼트합니다.

  5. EMA 기울기 관계는 트렌드 변화를 반영합니다. 가격 크로스오버는 진입을 확인합니다.

이점 분석

  1. 여러 EMA는 트렌드 판단의 정확성을 향상시킵니다.

  2. 빠른, 중간 및 느린 EMA는 추세와 통합을 합리적으로 구별합니다.

  3. EMA 기울기 변화는 트렌드 변화에 대한 초기 지시를 제공합니다.

  4. 가격 크로스오버는 가짜 브레이크오버를 피하기 위해 더욱 확증됩니다.

  5. 항상 포지션을 유지하면 트렌드 기회를 완전히 잡을 수 있습니다.

위험 분석

  1. EMA에만 의존하는 것은 범위 제한 기간 동안 큰 포지션 위험을 초래합니다.

  2. 부적절한 EMA 매개 변수는 전환점을 놓칠 수 있습니다.

  3. 트렌드 강도를 파악할 수 없는 것은 조기 반전 진입의 위험이 있습니다.

  4. 단일 거래 손실 통제가 없습니다.

개선 방향

  1. 최적의 매개 변수를 찾기 위해 다른 EMA 조합을 테스트합니다.

  2. 강도를 결정하기 위해 MACD와 같은 다른 지표를 추가하십시오.

  3. 위험 통제를 위한 스톱 로스 메커니즘을 추가합니다.

  4. 트렌드 강도를 평가하여 조기 반전 엔트리를 피하십시오.

  5. 자본 관리에 대한 포지션 크기를 최적화하십시오.

  6. 트렌드가 불안해지면 일시적으로 거래를 중단하십시오.

요약

이 전략은 트렌드를 결정하기 위해 EMA 콤보를 합리적으로 사용합니다. 그러나 EMA에만 의존하는 것은 한계를 가지고 있으며 더 많은 지표를 통합 할 수있는 큰 최적화 공간을 남겨두고 있습니다. 안정성을 향상시키기 위해 위험 통제 메커니즘도 필요합니다. 전반적으로 프레임워크는 과학적으로 설계되었으며 지속적인 개선 후에 강력한 트렌드 거래 전략으로 성장할 가능성이 있습니다.


/*backtest
start: 2023-08-20 00:00:00
end: 2023-09-19 00:00:00
period: 6h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
strategy("EMA Slope + EMA Cross Strategy (by ChartArt)", shorttitle="CA_-_EMA_slope_cross", overlay=true)

// ChartArt's EMA Slope + EMA Cross Strategy
//
// Version 1.0
// Idea by ChartArt on March 10, 2018.
//
// This strategy uses divergences between
// three moving averages and their slope
// directions as well as crosses between
// the price and the moving averages
// to switch between long/short positions.
//
// The strategy is non-stop in the market
// and always either long or short.
// 
// In addition the moving averages are colored
// depending if they are trending up or down.
//
// List of my work: 
// https://www.tradingview.com/u/ChartArt/

// Input
price = input(close)
MA1_Length = input(2,step=1, title="EMA 1 Length")
MA2_Length = input(4,step=1, title="EMA 2 Length")
MA3_Length = input(20,step=1, title="EMA 3 Length")

switch1=input(true, title="Show Bar Color?")
switch2=input(true, title="Show Moving Averages?")

// Calculation
MA1 = ema(price, MA1_Length)
MA2 = ema(price, MA2_Length)
MA3 = ema(price, MA3_Length)

// Strategy
long = crossunder(price, MA3) or ( change(price)<0 and change(MA1)<0 and crossunder(price,MA1) and change(MA2)>0 )
short = crossover(price, MA3) or ( change(price)>0 and change(MA1)>0 and crossover(price,MA1)  and change(MA2)<0 ) 

if long
    strategy.entry("Long", strategy.long, comment="Long")

if short
    strategy.entry("Short", strategy.short, comment="Short")

// Strategy Alert
alertcondition(long, title='EMA Slope + EMA Cross Strategy, Long Alert', message='Go Long!')
alertcondition(short, title='EMA Slope + EMA Cross Strategy, Short Alert', message='Go Short!')

// MA trend bar color
up =  change(MA2)>0 and change(MA3)>0
dn =  change(MA2)<0 and change(MA3)<0
bar_color = up?green:dn?red:blue
barcolor(switch1?bar_color:na)

// MA trend output color
MA2_color = change(MA2)>0?lime:change(MA2)<0?red:blue
MA3_color = change(MA3)>0?lime:change(MA3)<0?red:blue

// MA output
EMA2 = plot(switch2?MA2:na, title="EMA 2", style=linebr, linewidth=2, color=MA2_color)
EMA3 = plot(switch2?MA3:na, title="EMA 3", style=linebr, linewidth=4, color=MA3_color)
fill(EMA2, EMA3, color=silver, transp=50)

//plot(strategy.equity, title="equity", color=red, linewidth=2, style=areabr)

더 많은