
이 전략은 Hull MA, 가격 채널, EMA 신호 및 선형 회귀를 결합한 변동 거래 전략이다. 이 전략은 Hull MA를 사용하여 시장 추세 방향을 판단하고, 가격 채널 및 선형 회귀를 판단 하위 지역을 판단하고, EMA 신호를 판단 시장에 들어가는 시점을 판단하여 중단선 추세를 포착한다.
이 전략은 주로 다음과 같은 몇 가지 지표로 구성됩니다.
입력 논리:
다중 입구: Hull MA 상향과 상반된 가격, 짧은 EMA를 가로질러 상향으로 선형 회귀 허드 엔트리: Hull MA 하향으로 하향 레일보다 저렴하며, 선형 회귀 하향으로 단기 EMA를 통과
출전 논리:
다중 출전: 하차선보다 낮은 가격으로 선형 회귀를 거쳐 하차 空頭出場: 상반도의 가격과 상향의 선형 회귀를 통과한다
이 전략은 다음과 같은 장점을 가지고 있습니다.
이 전략에는 위험도 있습니다.
다음의 몇 가지 측면에서 최적화할 수 있습니다.
이 전략은 Hull MA, 가격 채널, EMA 및 선형 회귀와 같은 여러 지표를 통합하여 보다 완전한 중단계 휘저기 거래 전략을 형성한다. 단일 지표에 비해 이 전략은 판단 정확도를 크게 향상시킬 수 있으며, 추세와 반동에서 이익을 잡을 수 있다. 그러나 기술 분석 기반이 필요한 특정 위험이 있습니다.
/*backtest
start: 2023-11-23 00:00:00
end: 2023-11-30 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Swing Hull/SonicR/EMA/Linear Regression Strategy", overlay=true)
//Hull MA
n=input(title="HullMA Period",defval=377)
//
n2ma=2*wma(close,round(n/2))
nma=wma(close,n)
diff=n2ma-nma
sqn=round(sqrt(n))
//
n2ma1=2*wma(close[1],round(n/2))
nma1=wma(close[1],n)
diff1=n2ma1-nma1
sqn1=round(sqrt(n))
//
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
condDown = n2 >= n1
condUp = condDown != true
col =condUp ? lime : condDown ? red : yellow
plot(n1,title="Hull MA", color=col,linewidth=3)
// SonicR + Line reg
EMA = input(defval=89, title="EMA Signal")
HiLoLen = input(34, minval=2,title="High Low channel Length")
lr = input(89, minval=2,title="Linear Regression Length")
pacC = ema(close,HiLoLen)
pacL = ema(low,HiLoLen)
pacH = ema(high,HiLoLen)
DODGERBLUE = #1E90FFFF
// Plot the Price Action Channel (PAC) base on EMA high,low and close//
L=plot(pacL, color=DODGERBLUE, linewidth=1, title="High PAC EMA",transp=90)
H=plot(pacH, color=DODGERBLUE, linewidth=1, title="Low PAC EMA",transp=90)
C=plot(pacC, color=DODGERBLUE, linewidth=2, title="Close PAC EMA",transp=80)
//Moving Average//
signalMA =ema(close,EMA)
plot(signalMA,title="EMA Signal",color=black,linewidth=3,style=line)
linereg = linreg(close, lr, 0)
lineregf = linreg(close, HiLoLen, 0)
cline=linereg>linereg[1]?green:red
cline2= lineregf>lineregf[1]?green:red
plot(linereg, color = cline, title = "Linear Regression Curve Slow", style = line, linewidth = 1)
//plot(lineregf, color = cline2, title = "Linear Regression Curve Fast", style = line, linewidth = 1)
longCondition = n1>n2
shortCondition = longCondition != true
closeLong = lineregf-pacH>(pacH-pacL)*2 and close<lineregf and linereg>signalMA
closeShort = pacL-lineregf>(pacH-pacL)*2 and close>lineregf and linereg<signalMA
if shortCondition
if (close[0] < signalMA[0] and close[1] > pacL[1] and linereg>pacL and close<n1 and pacL<n1) //cross entry
strategy.entry("SHORT", strategy.short, comment="Short")
strategy.close("SHORT", when=closeShort) //output logic
if longCondition // swing condition
if (close[0] > signalMA[0] and close[1] < pacH[1] and linereg<pacH and close>n1 and pacH>n1) //cross entry
strategy.entry("LONG", strategy.long, comment="Long")
strategy.close("LONG", when=closeLong) //output logic