이중 배조 MA 판단 기준 거래 전략

저자:차오장, 날짜: 2023-09-13 13:48:30
태그:

이 전략은 듀얼 헐 이동 평균과 일일 촛불 비교의 조합을 기반으로 거래하며, 장기/단기 조건에 대한 판단 문턱을 사용합니다. 또한 위험 관리에 고정 스톱 로스/익률을 사용합니다.

전략 논리:

  1. 두 배 배의 MAs를 계산하고 현재의 값을 이전 기간과 비교합니다.

  2. 매일 가까운 변화율을 계산하고 긴/단한 판단의 임계치를 설정합니다.

  3. 빠른 MA가 느린 MA를 넘어서고, 일일 변동이 문턱을 넘으면 긴 거리가 됩니다.

  4. 고정된 스톱 로스를 사용해서 수익을 취하고 타격되면 포지션을 닫습니다.

  5. 또한 최대 오픈 포지션 제한을 설정할 수 있습니다.

장점:

  1. 이중 헬스매는 정확도를 높이고 매일 변경하면 편향이 확인됩니다

  2. 임계값은 작은 역동적인 움직임에 의해 흔들리지 않도록 합니다.

  3. SL/TP는 수익을 확보하고 위험을 통제하는데 도움이 됩니다.

위험성:

  1. 잘못된 임계 설정은 기회를 놓칠 수 있습니다. 신중한 테스트가 필요합니다.

  2. 고정된 SL/TP 유연하게 조정할 수 없으므로 부적절한 설정의 위험이 있습니다.

  3. 헬스 MA와 일일 변경 지연 모두

요약하자면, 위험 통제와 함께 이중 지표 판단 시스템은 어느 정도 안정성을 향상시킬 수 있습니다. 그러나 이상적인 구성을 찾기 위해서는 여전히 최적화가 필요합니다.


/*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)

더 많은