
이 전략은 극한값법으로 통계적 변동률을 계산합니다. 이것은 최고 가격, 최저 가격, 종결 가격의 극한값과 시간적 요소를 결합하여 통계적 변동률을 계산합니다. 이 변동률은 자산 가격의 변동성을 반영합니다. 전략은 변동률이 설정된 하위값보다 높거나 낮을 때, 그에 따른 다중 또는 공백 거래를합니다.
일정 시간 동안의 최고 가격, 최저 가격, 종결 가격의 극치를 계산합니다.
극대값법 공식을 적용하여 통계적 변동률을 계산한다
SqrTime = sqrt(253 / Length)
Vol = ((0.6 * log(xMaxC / xMinC) * SqrTime) + (0.6 * log(xMaxH / xMinL) * SqrTime)) * 0.5
변동률과 설정된 상하한값을 비교하여 거래 신호를 생성합니다.
pos = iff(nRes > TopBand, 1,
iff(nRes < LowBand, -1, nz(pos[1], 0)))
트레이딩 신호에 따라 더 많이 또는 더 적게 할 수 있습니다.
이 전략의 주요 장점은 다음과 같습니다.
이 전략에는 다음과 같은 위험들이 있습니다.
대책과 해결책:
이 전략의 최적화 방향은:
이 전략은 극대수법으로 통계적 변동률을 계산하여 변동률 이진성을 포착하여 거래 신호를 생성한다. 단순한 이동 평균과 같은 지표에 비해 시장의 변동성을 더 잘 반영하고 역전을 포착한다. 동시에, 극대수법 알고리즘은 결과를 더 안정적이고 신뢰할 수 있게 만든다. 매개 변수를 조정하고 최적화함으로써 이 전략은 다양한 시장 상황에 적응할 수 있으며, 거래 아이디어와 통계적 변동률 지표는 추가 연구와 응용에 가치가 있다.
/*backtest
start: 2022-12-19 00:00:00
end: 2023-12-25 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 22/11/2014
// This indicator used to calculate the statistical volatility, sometime
// called historical volatility, based on the Extreme Value Method.
// Please use this link to get more information about Volatility.
//
// You can change long to short in the Input Settings
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
strategy(title="Statistical Volatility - Extreme Value Method ", shorttitle="Statistical Volatility Backtest")
Length = input(30, minval=1)
TopBand = input(0.005, step=0.001)
LowBand = input(0.0016, step=0.001)
reverse = input(false, title="Trade reverse")
hline(TopBand, color=red, linestyle=line)
hline(LowBand, color=green, linestyle=line)
xMaxC = highest(close, Length)
xMaxH = highest(high, Length)
xMinC = lowest(close, Length)
xMinL = lowest(low, Length)
SqrTime = sqrt(253 / Length)
Vol = ((0.6 * log(xMaxC / xMinC) * SqrTime) + (0.6 * log(xMaxH / xMinL) * SqrTime)) * 0.5
nRes = iff(Vol < 0, 0, iff(Vol > 2.99, 2.99, Vol))
pos = iff(nRes > TopBand, 1,
iff(nRes < LowBand, -1, nz(pos[1], 0)))
possig = iff(reverse and pos == 1, -1,
iff(reverse and pos == -1, 1, pos))
if (possig == 1)
strategy.entry("Long", strategy.long)
if (possig == -1)
strategy.entry("Short", strategy.short)
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nRes, color=blue, title="Statistical Volatility")