크로싱 이동 평균 트렌드 추적 전략

저자:차오장, 날짜: 2024-01-03 17:01:38
태그:

img

전반적인 설명

이 전략은 이중 이동 평균의 크로스를 계산하여 가격 트렌드를 판단하고 특정 매개 변수 제한으로 구매 및 판매 신호를 발행합니다. 주로 세 가지 부분으로 구성됩니다. 첫째, 빠르고 느린 이동 평균의 크로스를 계산하여 가격 트렌드를 판단합니다. 둘째, 잘못된 거래를 피하기 위해 특정 매개 변수 제한을 설정합니다. 셋째, 위험을 제어하기 위해 스톱 이윤과 스톱 손실을 사용합니다.

전략 원칙

이 전략의 핵심은 빠른 이동 평균과 느린 이동 평균을 계산하는 데 있다. 빠른 이동 평균은 전체 이동 평균 기간의 절반의 기간을 가지고 있으며, 가격 변화에 더 민감하다. 느린 이동 평균은 전체 이동 평균 기간을 가지고 있으며, 가격 변화를 보다 원활하게 반영한다. 빠른 이동 평균이 느린 평균보다 높을 때 가격이 상승한다고 생각되며, 아래로 떨어지면 하락한다.

또한 전략은 잘못된 거래를 피하기 위해 특정 매개 변수를 설정합니다. 예를 들어, 결정 문턱은 두 이동 평균 사이의 차이가 특정 수준을 초과 할 때만 신호가 발송되도록 보장합니다. 신뢰 매개 변수는 작은 가격 변동을 필터링하는 데 사용됩니다.

마지막으로, 스톱프로프트와 스톱손실은 위험을 제어하기 위해 사용된다. 오픈프로프트가 스톱프로프트 포인트보다 작거나 스톱프로프트 포인트보다 크면 포지션은 폐쇄된다. 이는 단일 거래의 손실을 효과적으로 제한한다.

이점 분석

이 전략의 가장 큰 장점은 이동 평균 지표를 통해 가격 추세와 변동성 특성을 판단하는 것을 결합하는 것입니다. 이중 이동 평균의 크로스는 가격 추세를 결정하기위한 고전적인 효과적인 기술적 접근법입니다. 매개 변수 최적화로 추세를 정확하게 파악 할 수 있습니다. 신뢰 매개 변수는 불안정한 시장을 효과적으로 필터링하고 빈번한 잘못된 거래를 피할 수 있습니다.

또한, 의사 결정 문턱, 스톱 노프트 및 스톱 로스트와 같은 매개 변수들은 또한 높은 가격과 낮은 가격의 판매를 피함으로써 거래 위험을 크게 줄일 수 있습니다.

위험 분석

이 전략의 주요 위험은 이중 이동 평균에서 잘못된 신호가 발생할 가능성이 있습니다. 빠르고 느린 MAs 모두 갑작스러운 이벤트에 천천히 반응하는 가중 이동 평균이며, 따라서 단기 가격 반전을 놓치고 있습니다. 이 시점에서 신뢰 매개 변수는 이중 확인을 제공할 수 있습니다.

또한 스톱프로프트 및 스톱러스트 포인트의 부적절한 설정은 또한 위험을 증가시킬 수 있습니다. 너무 높은 수익 목표 및 낮은 스톱러스트 포인트는 예상 이상의 손실로 이어질 수 있습니다. 다른 거래 제품의 특성 및 변동성에 따라 합리적인 매개 변수를 설정해야합니다.

최적화 방향

이 전략은 다음과 같은 측면에서 최적화 될 수 있습니다.

  1. 이동 평균 기간을 최적화하고, 다른 주기의 가격 변동을 더 잘 모델링할 수 있도록 적응 가능한 이동 평균을 설정합니다.

  2. 스톱프로프트와 스톱러스트를 위한 동적 추적 메커니즘을 설정하고, 시장 조건에 따라 실시간으로 변동성을 계산하여 스톱포인트가 동적으로 변화할 수 있도록 합니다.

  3. 가격 트렌드 방향을 판단하는 기계 학습 모델을 늘리고, 현재 가격 움직임을 결정하는 데 더 많은 역사적 데이터를 활용하고, 잘못된 신호를 줄입니다.

결론

일반적으로, 이것은 고전적인 간단하고 효과적인 트렌드 거래 전략이다. 트렌드를 결정하기 위해 이중 이동 평균 크로스를 사용하며, 위험을 제어하기 위한 매개 변수를 설정하며, 멀티 제품 거래에 높은 구성성을 가지고 있다. 기계 학습과 같은 더 지능적인 판단 수단이 도입될 수 있다면, 전반적인 효과는 추가 연구를 위해 더욱 좋을 수 있다.


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

//@version=2
// Any timeFrame ok but good on 15 minute & 60 minute , Ichimoku + Daily-Candle_cross(DT) + HULL-MA_cross + MacD combination 420 special blend
strategy("Trade Signal", shorttitle="Trade Alert", overlay=true )
keh=input(title="Double HullMA",defval=14, minval=1)
dt = input(defval=0.0010, title="Decision Threshold (0.001)", type=float, step=0.0001)
SL = input(defval=-10.00, title="Stop Loss in $", type=float, step=1)
TP = input(defval=100.00, title="Target Point in $", type=float, step=1)
ot=1
n2ma=2*wma(close,round(keh/2))
nma=wma(close,keh)
diff=n2ma-nma
sqn=round(sqrt(keh))
n2ma1=2*wma(close[1],round(keh/2))
nma1=wma(close[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
confidence=(request.security(syminfo.tickerid, '5', close[1])-request.security(syminfo.tickerid, '60', close[1]))/request.security(syminfo.tickerid, '60', close[1])
conversionPeriods = input(9, minval=1, title="Conversion Line Periods")
basePeriods = input(26, minval=1, title="Base Line Periods")
laggingSpan2Periods = input(52, minval=1, title="Lagging Span 2 Periods")
displacement = input(26, minval=1, title="Displacement")
donchian(len) => avg(lowest(len), highest(len))
conversionLine = donchian(conversionPeriods)
baseLine = donchian(basePeriods)
leadLine1 = avg(conversionLine, baseLine)
leadLine2 = donchian(laggingSpan2Periods)
LS=close, offset = -displacement
MACD_Length = input(9)
MACD_fastLength = input(12)
MACD_slowLength = input(26)
MACD = ema(close, MACD_fastLength) - ema(close, MACD_slowLength)
aMACD = ema(MACD, MACD_Length)
closelong = n1<n2 and close<n2 and confidence<dt or strategy.openprofit<SL or strategy.openprofit>TP
if (closelong)
    strategy.close("Long")
closeshort = n1>n2 and close>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 close>n2 and leadLine1>leadLine2 and open<LS and MACD>aMACD
if (longCondition)
    strategy.entry("Long",strategy.long)
shortCondition = n1<n2 and strategy.opentrades<ot and confidence<dt and close<n2 and leadLine1<leadLine2 and open>LS and MACD<aMACD
if (shortCondition)
    strategy.entry("Short",strategy.short)

//alerts
alertcondition(closelong, title='Close Buy Position', message='Close Buy Position')
alertcondition(closeshort, title='Close Short Position', message='Close Short Position')
alertcondition(longCondition, title='Buy Signal', message='Buy Signal Alert')
alertcondition(shortCondition, title='Sell Signal', message='Sell Signal Alert')

//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)
plot(conversionLine, color=#0496ff, title="Conversion Line")
plot(baseLine, color=#991515, title="Base Line")
plot(close, offset = -displacement, color=#459915, title="Lagging Span")
p1=plot (leadLine1, offset = displacement, color=green,  title="Lead 1")
p2=plot (leadLine2, offset = displacement, color=red,  title="Lead 2")
fill(p1, p2, color = leadLine1 > leadLine2 ? green : red)
// remove the "//" from before the plot script if want to see the indicators on chart

더 많은