개선 된 파동 트렌드 추적 전략

저자:차오장, 날짜: 2024-01-31 15:35:41
태그:

img

개요: 이것은 경향을 식별하기 위해 웨이브 트렌드 오시일레이터를 활용하는 트렌드를 따르는 전략입니다. 웨이브 트렌드 라인을 그리기 위해 평균 가격과 절대 가격 차이의 기하급수적인 이동 평균을 계산합니다. 웨이브 트렌드 라인이 과반 구매 / 과반 판매 구역을 넘을 때 거래 신호가 생성됩니다. 이동 평균 및 볼륨에 대한 추가 필터는 잘못된 신호를 피합니다.

전략 논리:

  1. 평균 가격 ap = (고등 + 낮은 + 닫기) / 3를 계산합니다.

  2. eSA를 얻기 위해 ap의 n-period EMA를 계산합니다

  3. d를 얻기 위해 ap와 esa 사이의 절대적 차이점의 n 기간 EMA를 계산합니다.

  4. 파동 트렌드 라인을 계산합니다: ci = (ap - esa) / ((0.015*d)

  5. 최종 파동 트렌드 라인 tci, 즉 wt1을 얻기 위해 ci의 n2 기간 EMA를 계산합니다.

  6. wt2를 얻기 위해 wt1의 4주기 SMA를 계산합니다

  7. 플롯 과잉 매수/ 과잉 판매 평준 라인 obLevel1/2 및 osLevel1/2

  8. wt1이 obLevel2를 넘을 때 구매 신호를 생성합니다. wt1이 osLevel2를 넘을 때 판매 신호를 생성합니다.

  9. 이동 평균 emaFilter와 볼륨 필터 볼륨 필터를 필터로 추가하여 잘못된 신호를 피합니다

  10. 입출장 직후의 수익/손실 정지 세트

장점:

  1. 웨이브 트렌드 라인은 트렌드/반트렌드 전환을 잘 처리합니다.

  2. 이동 평균과 부피의 이중 필터로 신뢰성이 향상되었습니다.

  3. 여러 매개 변수는 단일 지표의 한계를 피합니다.

  4. 이윤/손실 중지 잠금 및 위험 통제

위험 과 한계:

  1. 매개 변수 선택은 열악한 성능 또는 과도한 장착으로 이어질 수 있습니다.

  2. 최적 매개 변수에 대한 최종 지침은 없습니다.

  3. 더 넓은 시장 조건을 무시합니다.

  4. 범위를 제한하고/변동성 있는 시장에서 화이트사그 위험

  5. 이윤/손실 중단 이외의 출구 규칙이 없습니다.

발전 가능성:

  1. 최적의 값을 찾기 위해 시간 프레임/자산에 걸쳐 테스트 매개 변수

  2. 낮은 변동성을 피하기 위해 변동성 측정치를 포함합니다.

  3. 신호 정확성을 향상시키기 위해 RSI와 같은 지표를 추가하십시오.

  4. 최적의 맞춤형 매개 변수를 찾기 위해 기계 학습 모델을 구축

  5. 트레일링 스톱 또는 변동성 이벤트 기반의 출구로 출구를 강화합니다.

결론:

이것은 추가 필터와 함께 웨이브 트렌드 지표를 통합하는 트렌드 다음 전략이다. 트렌드 전환을 식별하는 웨이브 트렌드 라인의 능력을 활용하고, 잘못된 신호를 피하기 위해 이동 평균 및 볼륨 필터를 사용하고, 대부분의 중장기 트렌드를 캡처하는 것을 목표로합니다. 수익/손실을 중지하는 것은 위험을 제어하는 데 사용됩니다. 매개 변수 최적화, 더 많은 지표 추가 및 기계 학습과 같은 기술로 더 많은 도구 및 시간 프레임에서 성능을 향상시키는 중요한 기회가 있습니다.


/*backtest
start: 2023-12-31 00:00:00
end: 2024-01-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=5
strategy("Bush Strategy test", shorttitle="Nique Audi", overlay=false)

// Paramètres
n1 = input(10, title="Channel Length")
n2 = input(21, title="Average Length")
obLevel1 = input(60, title="Over Bought Level 1")
obLevel2 = input(53, title="Over Bought Level 2")
osLevel1 = input(-65, title="Over Sold Level 1")
osLevel2 = input(-60, title="Over Sold Level 2")
takeProfitPercentage = input(1, title="Take Profit (%)")
stopLossPercentage = input(0.50, title="Stop Loss (%)")

// Calculs
ap = hlc3 
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)

wt1 = tci
wt2 = ta.sma(wt1, 4)

// Tracé des lignes
plot(0, color=color.gray)
plot(obLevel1, color=color.red)
plot(osLevel1, color=color.green)
plot(obLevel2, color=color.red, style=plot.style_line)
plot(osLevel2, color=color.green, style=plot.style_line)

plot(wt1, color=color.green)
plot(wt2, color=color.red, style=plot.style_line)

// Tracé de la différence entre wt1 et wt2 en bleu
hline(0, "Zero Line", color=color.gray)

// Conditions d'entrée long et court
longCondition = ta.crossover(wt1, obLevel2)
shortCondition = ta.crossunder(wt1, osLevel2)

// Tracé des signaux d'achat et de vente
plotshape(series=longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Buy Signal")
plotshape(series=shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Sell Signal")

// Conditions d'entrée et de sortie
strategy.entry("Long", strategy.long, when=longCondition)
strategy.entry("Short", strategy.short, when=shortCondition)

// Niveaux de prise de profit pour les positions longues et courtes
longTakeProfitLevel = strategy.position_avg_price * (1 + takeProfitPercentage / 100)
shortTakeProfitLevel = strategy.position_avg_price * (1 - takeProfitPercentage / 100)

// Vérification si les niveaux de prise de profit sont atteints
longTakeProfitReached = strategy.position_size > 0 and high >= longTakeProfitLevel
shortTakeProfitReached = strategy.position_size < 0 and low <= shortTakeProfitLevel

// Tracé des formes de prise de profit
plotshape(series=longTakeProfitReached, style=shape.xcross, location=location.belowbar, color=color.blue, size=size.small, title="Take Profit Long")
plotshape(series=shortTakeProfitReached, style=shape.xcross, location=location.abovebar, color=color.blue, size=size.small, title="Take Profit Short")

// Niveaux de stop loss pour les positions longues et courtes
longStopLossLevel = strategy.position_avg_price * (1 - stopLossPercentage / 100)
shortStopLossLevel = strategy.position_avg_price * (1 + stopLossPercentage / 100)

// Vérification si les niveaux de stop loss sont atteints
longStopLossReached = strategy.position_size > 0 and low <= longStopLossLevel
shortStopLossReached = strategy.position_size < 0 and high >= shortStopLossLevel

// Tracé des formes de stop loss
plotshape(series=longStopLossReached, style=shape.xcross, location=location.belowbar, color=color.red, size=size.small, title="Stop Loss Long")
plotshape(series=shortStopLossReached, style=shape.xcross, location=location.abovebar, color=color.red, size=size.small, title="Stop Loss Short")

// Fermeture des positions en cas de prise de profit ou de stop loss
strategy.close("Long", when=longTakeProfitReached or longStopLossReached)
strategy.close("Short", when=shortTakeProfitReached or shortStopLossReached)




더 많은