이중 이동 평균 오스실레이션 돌파 전략

저자:차오장, 날짜: 2023-11-27 17:44:49
태그:

img

전반적인 설명

이중 이동 평균 오스실레이션 돌파 전략은 채널을 형성하고 가격의 오스실레이션 트렌드를 판단하기 위해 서로 다른 기간의 두 이동 평균을 계산합니다. 가격이 채널을 돌파 할 때 거래 신호를 생성합니다. 이 전략은 또한 잘못된 돌파를 피하기 위해 주류 시장 방향 판단을 통합합니다.

전략 원칙

이 전략의 주요 단계는 다음과 같습니다.

  1. 두 개의 이동 평균을 계산합니다. 하나는 짧은 기간과 다른 하나는 긴 기간입니다. 짧은 MA는 현재 가격 추세를 반영하고 더 긴 MA는 주류 가격 추세를 반영합니다.

  2. 더 짧은 MA보다 높고 낮게 1 ATR을 추가하여 채널을 형성합니다. ATR은 현재 시장 변동성을 반영합니다.

  3. 구매 신호는 가격이 채널을 상향으로 돌파할 때 생성됩니다. 판매 신호는 가격이 채널을 상향으로 돌파할 때 생성됩니다.

  4. 주류 트렌드 판단을 포함합니다. 유효한 거래 신호는 단기 돌파구가 주류 트렌드 방향과 일치 할 때만 생성됩니다.

이러한 단계를 따라, 이 전략은 변동 추세의 돌파점을 포착하고 주류 추세에 참조하여 잘못된 신호를 피합니다.

이점 분석

이 전략의 장점:

  1. 이중 MA 채널은 현재 가격 변동 범위를 반영합니다.

  2. ATR 매개 변수는 채널 범위에서 실시간 시장 변동성을 추적할 수 있도록 합니다.

  3. 주류 트렌드 필터링은 변동 시장에서 잘못된 신호를 피합니다.

  4. 규칙은 간단하고 이해하기 쉬우며 학습과 연구에 적합합니다.

위험 분석

위험성:

  1. 실패한 돌파구는 좋은 기회를 놓칠 수 있습니다. 이윤을 취하고 재입입업함으로써 완화 될 수 있습니다.

  2. 주류 트렌드 판단은 시간 지연이 있고 모든 잘못된 신호를 제거 할 수 없습니다. MA 매개 변수를 최적화 할 수 있습니다.

  3. 스톱 로즈는 변동적인 시장에 침투할 수 있고, 동적으로 ATR을 조정할 수 있습니다.

최적화 방향

이 전략을 최적화하는 방법:

  1. 각기 다른 제품에 대한 MA 매개 변수를 최적화합니다.

  2. ATR 매개 변수를 최적화해서 변동성을 더 잘 추적해

  3. 부피 및 변동성 지표와 같은 추가 필터를 추가하여 잘못된 신호를 더 피합니다.

  4. 기계 학습을 사용하여 자동으로 매개 변수를 최적화합니다.

결론

이 이중 MA 오시슬레이션 돌파구 전략은 이중 MA 채널과 주류 필터링을 통해 오시슬레이션 트렌드를 캡처합니다. 간단하고 명확한 규칙으로 돌파구 거래 전략을 배우는 데 탁월한 예입니다. 매개 변수 및 신호 필터링의 추가 최적화는 수익성과 안정성을 향상시킬 수 있습니다.


/*backtest
start: 2022-11-20 00:00:00
end: 2023-11-26 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Anuj4912
//@version=4
strategy("Anuj4912", overlay=true)
res = input(title="Time Frame",  defval="120")
Factor=input(1, minval=1,maxval = 100)
Pd=input(1, minval=1,maxval = 100)

tp = input(500,title="Take Profit")
sl = input(400,title="Stop Loss")


Up=hl2-(Factor*atr(Pd))
Dn=hl2+(Factor*atr(Pd))
MUp=request.security(syminfo.tickerid,res,hl2-(Factor*atr(Pd)))
MDn=request.security(syminfo.tickerid,res,hl2+(Factor*atr(Pd)))

Mclose=request.security(syminfo.tickerid,res,close)

TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up
TrendDown=close[1]<TrendDown[1]? min(Dn,TrendDown[1]) : Dn

MTrendUp=Mclose[1]>MTrendUp[1]? max(MUp,MTrendUp[1]) : MUp
MTrendDown=Mclose[1]<MTrendDown[1]? min(MDn,MTrendDown[1]) : MDn

Trend = close > TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1)
Tsl = Trend==1? TrendUp: TrendDown

MTrend = Mclose > MTrendDown[1] ? 1: Mclose< MTrendUp[1]? -1: nz(MTrend[1],1)
MTsl = MTrend==1? MTrendUp: MTrendDown

linecolor = Trend == 1 ? green : red
plot(Tsl, color = linecolor , style = line , linewidth = 2,title = "SuperTrend")

Mlinecolor = MTrend == 1 ? blue : orange
plot(MTsl, color = Mlinecolor , style = line , linewidth = 2,title = "Main SuperTrend")

plotshape(cross(close,Tsl) and close>Tsl , "Up Arrow", shape.triangleup,location.belowbar,green,0,0)
plotshape(cross(Tsl,close) and close<Tsl , "Down Arrow", shape.triangledown , location.abovebar, red,0,0)

up = Trend == 1 and Trend[1] == -1 and MTrend == 1 
down = Trend == -1 and Trend[1] == 1 and MTrend == -1 
plotarrow(up ? Trend : na, title="Up Entry Arrow", colorup=lime, maxheight=60, minheight=50, transp=0)
plotarrow(down ? Trend : na, title="Down Entry Arrow", colordown=red, maxheight=60, minheight=50, transp=0)


golong = Trend == 1 and Trend[1] == -1 and MTrend == 1 
goshort = Trend == -1 and Trend[1] == 1 and MTrend == -1 

strategy.entry("Buy", strategy.long,when=golong)
strategy.exit("Close Buy","Buy",profit=tp,loss=sl)
   
   
strategy.entry("Sell", strategy.short,when=goshort)
strategy.exit("Close Sell","Sell",profit=tp,loss=sl)



더 많은