트렌드 다음 전략 세 가지 지표 클라우드 패턴에 기반

저자:차오장, 날짜: 2023-09-13 17:38:55
태그:

이 전략은 트리플 인디케이터 클라우드 패턴에 기반한 트렌드 다음 전략 (Trend Following Strategy Based on Triple Indicator Cloud Pattern) 이라고 불린다. 이는 트렌드를 따라 클라우드의 브레이크아웃을 거래하는 클라우드 패턴을 형성하기 위해 세 가지 다른 유형의 트렌드 인디케이터를 통합한다.

사용된 세 가지 지표는 다음과 같습니다.

카우프만 적응 이동 평균, 시장 변동성을 파악하는 데 민감합니다.

선체 이동 평균은 부드러운 회전으로 잘못된 신호를 필터링합니다.

슈퍼 트렌드 메커니즘, 가격 채널을 형성하여 최고를 추구하고 최저를 판매하지 않도록합니다.

모두 함께 구름 패턴을 형성합니다. 상단 띠는 세 가지 중 가장 높은 값이고, 하단 띠는 가장 낮은 값입니다.

거래의 논리는 다음과 같습니다.

촛불 높이가 구름 꼭대기 위로 떨어지면, 그것은 구매 신호를 위해 상승 트렌드 채널을 깨는 신호입니다.

클로저가 클라우드 바닥 아래로 떨어지면, 롱을 닫는 하락 트렌드의 시작을 표시합니다.

이 전략의 장점은 지표 콤보가 트렌드 상태를 더 정확하게 판단하여 잘못된 신호를 줄이는 것입니다. 그러나 매개 변수 최적화는 여전히 중요합니다. 손실 중지 또한 필수적입니다.

요약하자면, 트렌드를 결정하기 위해 여러 지표를 사용하는 것이 일반적이고 효과적인 접근법입니다. 그러나 거래자는 여전히 전략 조정에서 합리적인 재량과 유연성을 필요로합니다.


/*backtest
start: 2022-09-12 00:00:00
end: 2023-02-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © SnarkyPuppy

//@version=5
strategy("HKST Cloud", overlay=true, default_qty_type= strategy.percent_of_equity, default_qty_value=100)



////////////////nAMA
Lengthkaufman = input(20) 
xPrice = ohlc4
xvnoise = math.abs(xPrice - xPrice[1])
nfastend = 0.666
nslowend = 0.0645
nsignal = math.abs(xPrice - xPrice[Lengthkaufman])
nnoise = math.sum(xvnoise, Lengthkaufman)
nefratio = nnoise != 0? nsignal / nnoise : 0
nsmooth = math.pow(nefratio * (nfastend - nslowend) + nslowend, 2) 
nAMA =  float(0)
nAMA := nz(nAMA[1]) + nsmooth * (xPrice - nz(nAMA[1]))

//plot(nAMA,color=color.red)
///short=input(true)



///////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////

////////hull moving average
hull_len=input(20)
hull= ta.hma(nAMA,hull_len)

///////atr trail
atr_factor=input(2)
atr_period=input(5)
[supertrend, direction] = ta.supertrend(atr_factor,atr_period)

/////////cloud
band1= math.max(supertrend,hull,nAMA)
band2= math.min(supertrend,hull,nAMA)

b1=plot(band1, "band1", color = color.rgb(76, 175, 79, 85), style=plot.style_linebr)
b2=plot(band2, "band2", color = color.rgb(255, 82, 82, 78), style=plot.style_linebr)
fill(b1,b2,color.rgb(12, 50, 186, 75))
longCondition = ta.crossover(high,band1) //or ta.crossover(low,band2)
if (longCondition)
    strategy.entry("Up", strategy.long)

shortCondition =  ta.crossunder(low,band2) or close<band2
if (shortCondition) 
    strategy.close("Up", shortCondition)



더 많은