이동평균선 기울기와 교차를 기반으로 한 트렌드 트레이딩 전략


생성 날짜: 2023-09-20 14:32:22 마지막으로 수정됨: 2023-09-20 14:32:22
복사: 0 클릭수: 951
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

개요

이 전략은 다중 EMA의 기울기 방향과 교차 관계를 통해 트렌드 방향을 판단하여 멈추지 않는 트렌드 거래를 구현한다. 그것은 항상 호불호가 나거나 하락의 위치를 가질 수 있다.

전략 원칙

  1. 3개의 다른 주기의 EMA를 계산합니다. 각각 빠른, 중간, 느린 EMA죠.

  2. 빠른 EMA 위에 중간 속도 EMA를 통과하고, 중간 속도 EMA의 기울기가 교정될 때, 복수 신호를 생성한다.

  3. 빠른 EMA 아래로 중간 속도 EMA를 통과하고, 중간 속도 EMA의 기울기가 음이 되면, 공백 신호가 발생한다.

  4. 가격이 올라갈 때 EMA를 더하고, 떨어질 때 EMA를 더하지 마십시오.

  5. 빠른 또는 느린 EMA의 기울기 관계는 트렌드의 변화를 반영한다. 가격과 EMA의 교차 확인 입시.

우위 분석

  1. 다중 EMA 그룹은 트렌드 방향을 더 정확하게 판단한다.

  2. 빠른 EMA와 느린 EMA는 추세와 흔들림을 구분하는 것이 합리적입니다.

  3. 평균선 기울기 변화는 트렌드 변화를 알려줍니다.

  4. 가격 교차가 다시 확인되고, 가짜 돌파구를 피할 수 있다.

  5. 트렌드 기회를 잡기 위해 항상 포지션을 유지하십시오.

위험 분석

  1. EMA를 기준으로만 보면, 위기 상황에서 지분을 보유하는 것은 위험하다.

  2. EMA 파라미터가 잘못 설정되어 있어 전환점을 놓칠 수 있다.

  3. “이번 트렌드가 강하거나 약하다고 판단할 수 없고, 너무 일찍 역전할 수도 있다”.

  4. 단독 손실을 효과적으로 통제할 수 없습니다.

최적화 방향

  1. 다양한 EMA 변수 조합을 테스트하여 더 우수한 변수를 찾습니다.

  2. 다른 지표들을 추가하여 강점과 약점을 판단합니다.

  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)