
이것은 거래량 가중 평균 가격 (VWAP) 과 가만-클래스 변동률 (GKV) 에 기반한 적응 거래 전략이다. 이 전략은 변동률 동적으로 VWAP의 표준 차량 영역을 조정하여 시장 추세를 지능적으로 추적한다. 가격이 궤도를 돌파 할 때 더 많은 포지션을 열고 궤도를 돌파 할 때 평소 포지션을 만들면, 변동률이 더 커질수록 돌파 문이 더 높고, 변동률이 더 작을수록 돌파 문이 더 낮다.
전략의 핵심은 VWAP와 GKV 변동률을 결합하는 것이다. 우선 VWAP를 가격 중심으로 계산하고, 그 다음에는 종결 가격의 표준 차이를 사용하여 파장을 구성한다. 핵심은 GKV 공식을 사용하여 변동률을 계산하는 것이다. 이 공식은 열고 닫는 네 가지 가격을 고려하여 전통적인 변동률보다 더 정확하다. 변동률은 파장 폭을 동적으로 조정한다.
이 전략은 VWAP와 GKV 변동률 혁신을 결합하여 시장의 동적 추적을 구현한다. 그것의 적응 특성은 다양한 시장 환경에서 안정적인 성과를 유지할 수 있도록 한다. 약간의 잠재적인 위험이 있지만, 합리적인 위험 제어와 지속적인 최적화를 통해 전략은 좋은 적용 전망을 가지고 있다.
/*backtest
start: 2019-12-23 08:00:00
end: 2024-12-18 08:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("Adaptive VWAP Bands with Garman Klass Volatility", overlay=true)
// Inputs
length = input.int(25, title="Volatility Length")
vwapLength = input.int(14, title="VWAP Length")
vol_multiplier = input.float(1,title="Volatility Multiplier")
// Function to calculate Garman-Klass Volatility
var float sum_gkv = na
if na(sum_gkv)
sum_gkv := 0.0
sum_gkv := 0.0
for i = 0 to length - 1
sum_gkv := sum_gkv + 0.5 * math.pow(math.log(high[i]/low[i]), 2) - (2*math.log(2)-1) * math.pow(math.log(close[i]/open[i]), 2)
gcv = math.sqrt(sum_gkv / length)
// VWAP calculation
vwap = ta.vwma(close, vwapLength)
// Standard deviation for VWAP bands
vwapStdDev = ta.stdev(close, vwapLength)
// Adaptive multiplier based on GCV
multiplier = (gcv / ta.sma(gcv, length)) * vol_multiplier
// Upper and lower bands
upperBand = vwap + (vwapStdDev * multiplier)
lowerBand = vwap - (vwapStdDev * multiplier)
// Plotting VWAP and bands
plot(vwap, title="VWAP", color=color.blue, linewidth=2)
plot(upperBand, title="Upper Band", color=color.green, linewidth=1)
plot(lowerBand, title="Lower Band", color=color.red, linewidth=1)
var barColor = color.black
// Strategy: Enter long above upper band, go to cash below lower band
if (close > upperBand)
barColor := color.green
strategy.entry("Long", strategy.long)
else if (close < lowerBand)
barColor := color.fuchsia
strategy.close("Long")
barcolor(barColor)