더블 헐마(Double HullMA) 조합 판단 임계값 거래 전략


생성 날짜: 2023-09-13 13:48:30 마지막으로 수정됨: 2023-09-13 13:48:30
복사: 1 클릭수: 585
avatar of ChaoZhang ChaoZhang
1
집중하다
1617
수행원

이 전략은 듀얼 헐 이동 평균과 일일 K 라인 비교를 조합하여, 공백 조건 판단 하락값을 설정하여 거래한다. 또한, 위험 관리를 위해 스톱 로스 스톱 가격을 설정한다.

전략적 원칙:

  1. 이중 헐 이동 평균을 계산하고, 현재의 값과 이전 주기 크기의 관계를 비교한다.

  2. 일 K선 종결 가격 변화율을 계산하고, 공백 판결 마이너스를 설정한다.

  3. 빠른 선에서 느린 선을 통과하고, 일변률이 값을 초과할 때 더 많이 한다. 빠른 선 아래에서 느린 선을 통과하고, 일변률이 값보다 낮을 때 공백을 한다.

  4. 고정된 스톱 스톱 가격을 설정한다. 가격이 스톱 스톱을 만지면 적극적으로 평점한다.

  5. 최대 포지션 개설 수를 설정할 수 있습니다.

이 전략의 장점:

  1. 듀얼 헐MA는 판단 정확도를 높여준다. 일 K선 변화율은 전구 방향을 확인한다.

  2. 값 설정은 소액 가격의 역효과에 영향을 받지 않도록 합니다.

  3. 손해 차단장치는 수익을 고정하고 위험을 통제하는 데 도움이 됩니다.

이 전략의 위험은:

  1. 너무 높거나 너무 낮은 값을 설정하면 거래 기회를 놓치게 됩니다. 조심스럽게 테스트하십시오.

  2. 고정 스톱 스 가격은 유연하게 조정할 수 없으며, 부당한 설정의 위험이 있습니다.

  3. HullMA와 일일 변화율 모두 뒤쳐져 있다.

종합적으로 이 전략은 쌍 지표 판단과 위험 관리 조치를 통해 거래를 할 수 있으며 어느 정도 안정성을 높일 수 있습니다. 그러나 여전히 파라미터 최적화 문제에 주의를 기울이고 최적의 구성을 찾아야 합니다.

전략 소스 코드
/*backtest
start: 2022-09-06 00:00:00
end: 2023-02-21 00:00:00
period: 5d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=2
//                                                        Hull_MA_cross & Daily_Candle_cross combination with TP$ & SL$ setting
//                                                              (new script reducing effect of repaint on results)
//
strategy("Decision Threshold", shorttitle="DT", overlay=true, default_qty_type=strategy.percent_of_equity, max_bars_back=720, default_qty_value=100, calc_on_order_fills= true, calc_on_every_tick=true, pyramiding=0)
keh=input(title="Double HullMA",defval=14, minval=1)
dt = input(defval=0.0010, title="Decision Threshold",  step=0.0001)
SL = input(defval=-50000.00, title="Stop Loss in $",  step=1)
TP = input(defval=100000.00, title="Target Point in $", step=1)
p=input(ohlc4)
ot=1
n2ma=2*wma(p,round(keh/2))
nma=wma(p,keh)
diff=n2ma-nma
sqn=round(sqrt(keh))
n2ma1=2*wma(p[1],round(keh/2))
nma1=wma(p[1],keh)
diff1=n2ma1-nma1
sqn1=round(sqrt(keh))
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
b=n1>n2?lime:red
c=n1>n2?green:red
d=n1>n2?red:green
a1=plot(n1,color=c)
a2=plot(n2,color=c)
plot(cross(n1, n2) ? n1 : na, style = circles, color=b, linewidth = 4)
plot(cross(n1, n2) ? n1 : na, style = line, color=d, linewidth = 4)
confidence=(security(syminfo.tickerid, 'D', p)-security(syminfo.tickerid, 'D', p[1]))/security(syminfo.tickerid, 'D', p[1])
closelong = n1<n2 and p<n2 and confidence<dt or strategy.openprofit<SL or strategy.openprofit>TP
if (closelong)
    strategy.close("Long")
closeshort = n1>n2 and p>n2 and confidence>dt or strategy.openprofit<SL or strategy.openprofit>TP
if (closeshort)
    strategy.close("Short")
longCondition = n1>n2 and strategy.opentrades<ot and confidence>dt and p>n2
if (longCondition)
    strategy.entry("Long",strategy.long)
shortCondition = n1<n2 and strategy.opentrades<ot and confidence<dt and p<n2 
if (shortCondition)
    strategy.entry("Short",strategy.short)