
이 전략의 핵심 아이디어는 가격의 변동율을 사용하여 시장의 추세를 판단하는 것입니다. 변동율이 상승하면 시장이 새로운 추세를 형성하고 있음을 나타냅니다. 변동율이 감소하면 현재 추세가 종료되고 있음을 나타냅니다. 전략은 가격의 퍼센트 변화를 계산하고, 그에 대한 양평등 선 필링을 수행하여 가격 변동율을 반영하는 지표를 얻습니다. 지표 위에 신호선을 통과하면 구매 신호를 생성하고, 신호선을 통과하면 판매 신호를 생성합니다.
이 전략은 우선 가격의 변화율을 계산합니다.
i=(src/nz(src[1], src))*100
35의 평균선 필터링을 통해 1차 가격 변동률 지표pmol2를 얻는다. 20의 평균선 필터링을 통해 2차 필터링을 통해 최종 가격 변동률 지표pmol를 얻는다. 마지막으로, 10의 평균선 필터링을 통해 pmol의 신호선을 얻는다. pmol 위에 pmols를 통과하면 구매 신호가 발생하며, pmol 아래에 pmols를 통과하면 판매 신호가 발생한다.
최적화 방향:
이 전략은 비율 변화와 쌍평등선 필러브를 계산하여 가격 변동률을 추출하여 시장 추세 변화를 판단하는, 보다 성숙한 기술 지표 클래스 전략에 속한다. 이 전략은 추세를 포착하는 능력이 강하지만 전환점 능력을 식별하는 능력은 일반적이다. 매개 변수를 조정하고 보조 조건을 추가하여 최적화 할 수 있다.
/*backtest
start: 2022-12-01 00:00:00
end: 2023-12-07 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Strategy for DPMO", overlay=true)
src=input(close, title="Source")
length1=input(35, title="First Smoothing")
length2=input(20, title="Second Smoothing")
siglength=input(10, title="Signal Smoothing")
ebc=input(false, title="Enable Bar Colors")
upSign = '↑' // indicates the indicator shows uptrend
downSign = '↓' // incicates the indicator showing downtrend
exitSign ='x' //indicates the indicator uptrend/downtrend ending
calc_csf(src, length) =>
sm = 2.0/length
csf=(src - nz(csf[1])) * sm + nz(csf[1])
csf
i=(src/nz(src[1], src))*100
pmol2=calc_csf(i-100, length1)
pmol=calc_csf( 10 * pmol2, length2)
pmols=ema(pmol, siglength)
d=pmol-pmols
hc=d>0?d>d[1]?lime:green:d<d[1]?red:orange
buyDPMO = hc==lime and hc[1]!=lime
closeBuyDPMO = hc==green and hc[1]!=green
sellDPMO = hc==red and hc[1]!=red
closeSellDPMO = hc==orange and hc[1]!=orange
plotshape(buyDPMO, color=lime, style=shape.labelup, textcolor=#000000, text="DPMO", location=location.belowbar, transp=0)
plotshape(closeBuyDPMO, color=green, style=shape.labelup, textcolor=#ffffff, text="X", location=location.belowbar, transp=0)
plotshape(sellDPMO, color=red, style=shape.labeldown, textcolor=#000000, text="DPMO", location=location.abovebar, transp=0)
plotshape(closeSellDPMO, color=orange, style=shape.labeldown, textcolor=#ffffff, text="X", location=location.abovebar, transp=0)
barcolor(ebc?hc:na)
strategy.entry("Long", strategy.long, when=buyDPMO)
strategy.close("Long", when=closeBuyDPMO or sellDPMO)
strategy.entry("Short", strategy.short, when=sellDPMO)
strategy.close("Short", when=closeSellDPMO or buyDPMO)