웨이브 트렌드 멀티플 스톱 로스 및 멀티플 테이크 프로핏 전략


생성 날짜: 2023-12-01 18:09:12 마지막으로 수정됨: 2023-12-01 18:09:12
복사: 0 클릭수: 814
avatar of ChaoZhang ChaoZhang
1
집중하다
1619
수행원

웨이브 트렌드 멀티플 스톱 로스 및 멀티플 테이크 프로핏 전략

개요

이 전략은 LazyBear의 원시 웨이브 트렌드 전략으로, 두 번째 스톱, 여러 스톱 가격 및 고 시간 프레임 EMA 필터를 추가했다. 그것은 웨이브 트렌드 지표를 사용하여 거래 신호를 생성하고, EMA 필터링과 스톱 스톱 관리를 결합하여 트렌드 추적 거래를 자동화했다.

전략 원칙

이 전략의 핵심 지표는 WaveTrend 지표이며, 3개의 부분으로 구성되어 있습니다:

  1. AP: 평균 가격 = (최고 가격 + 최저 가격 + 종점 가격) / 3

  2. ESA: AP의 n1회 EMA

  3. CI: ((AP-ESA) / (0.015×AP-ESA의 n1기 EMA) 의 절대값의 n1기 EMA

  4. TCI: TCI의 n2기 EMA, 즉 파동 트렌드 라인 1[WT1]

  5. WT2:WT1의 4주기 SMA

WT1 위를 뚫고 WT2를 뚫고 황금 포크를 생성할 때, 더 많이 한다. WT1 아래를 뚫고 WT2를 뚫고 황금 포크를 생성할 때, 평점을 한다.

또한, 전략은 높은 시간 프레임 EMA를 필터로 도입하여, 가격이 EMA보다 높을 때만 더 많은 것을 할 수 있고, EMA보다 낮을 때 공백을 할 수 있으며, 이로 인해 일부 가짜 신호를 필터링 할 수 있습니다.

전략적 이점

  1. 트렌드를 자동으로 추적하기 위해 파동 트렌드 지표를 사용하여 인적 판단 오류를 방지하십시오.
  2. 두 번째 중지 손실을 추가하여 단편 손실을 효과적으로 제어합니다.
  3. 여러 정지 가격, 최대 수익 고정
  4. EMA 필터, 가짜 신호를 필터링, 승률을 높여라

위험과 최적화

  1. “이런 일이 벌어진다면, 우리는 더 많은 손실을 입게 될 것입니다”.
  2. 잘못된 매개 변수 설정으로 인해 거래가 너무 자주 발생할 수 있습니다.
  3. 다양한 변수 조합을 테스트할 수 있으며, 최적화 변수
  4. 다른 지표와 함께 추세 전환을 고려할 수 있습니다.

요약하다

이 전략은 종합적으로 트렌드 추적, 위험 제어, 이익 극대화 등의 여러 차원을 고려하고, 파동 트렌드 지표를 통해 트렌드를 자동으로 포착하고, EMA 필터와 함께 거래 효율성을 높이고, 트렌드를 파악하면서 위험을 제어하는 효율적이고 안정적인 트렌드 추적 전략이다. 추가적인 매개 변수 최적화 및 역전 판단을 증가시킴으로써 이 전략의 적용성을 더욱 확장할 수 있다.

전략 소스 코드
/*backtest
start: 2023-10-31 00:00:00
end: 2023-11-30 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © undacovacobra

//@version=4
strategy("WaveTrend Strategy [LazyBear] with Secondary Stop Loss", overlay=true)

// Input parameters
n1 = input(10, "Channel Length")
n2 = input(21, "Average Length")
obLevel1 = input(60, "Over Bought Level 1")
obLevel2 = input(53, "Over Bought Level 2")
osLevel1 = input(-60, "Over Sold Level 1")
osLevel2 = input(-53, "Over Sold Level 2")
useEmaFilter = input(false, "Use EMA Filter")
emaLength = input(50, "EMA Length")
emaTimeFrame = input("60", "EMA Time Frame")
tradeMode = input("Both", "Trade Mode", options=["Long Only", "Short Only", "Both"])
useSecondarySL = input(false, "Use Secondary Stop Loss")
slPercentage = input(5.0, "Stop Loss Percentage (%)")

// WaveTrend Indicator Calculations
ap = hlc3 
esa = ema(ap, n1)
d = ema(abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ema(ci, n2)
wt1 = tci
wt2 = sma(wt1, 4)

// EMA Calculation with Selected Time Frame
getEma(timeFrame) =>
    security(syminfo.tickerid, timeFrame, ema(close, emaLength))

emaFilter = getEma(emaTimeFrame)

// Secondary Stop Loss Calculation
longStopPrice = strategy.position_avg_price * (1 - slPercentage / 100)
shortStopPrice = strategy.position_avg_price * (1 + slPercentage / 100)

// Long Entry and Exit Conditions with EMA Filter and Trade Mode
longEntry = crossover(wt1, wt2) and wt2 < osLevel1 and (not useEmaFilter or close > emaFilter) and (tradeMode == "Long Only" or tradeMode == "Both")
if (longEntry)
    strategy.entry("Long", strategy.long)
longExit = crossunder(wt1, wt2) and wt2 > obLevel1
if (longExit)
    strategy.close("Long")
if (useSecondarySL and strategy.position_size > 0 and low < longStopPrice)
    strategy.close("Long", comment="SL Hit")

// Short Entry and Exit Conditions with EMA Filter and Trade Mode
shortEntry = crossunder(wt1, wt2) and wt2 > obLevel1 and (not useEmaFilter or close < emaFilter) and (tradeMode == "Short Only" or tradeMode == "Both")
if (shortEntry)
    strategy.entry("Short", strategy.short)
shortExit = crossover(wt1, wt2) and wt2 < osLevel1
if (shortExit)
    strategy.close("Short")
if (useSecondarySL and strategy.position_size < 0 and high > shortStopPrice)
    strategy.close("Short", comment="SL Hit")

// Plotting
plot(0, color=color.gray)
plot(obLevel1, color=color.red)
plot(osLevel1, color=color.green)
plot(obLevel2, color=color.red, style=plot.style_cross)
plot(osLevel2, color=color.green, style=plot.style_cross)
plot(wt1, color=color.green)
plot(wt2, color=color.red, style=plot.style_cross)
plot(wt1-wt2, color=color.blue, style=plot.style_area, transp=80)
plot(emaFilter, color=color.blue)