
この戦略は,極値法を使用して統計的変動率,または歴史的変動率を計算します. それは,最高価格,最低価格,閉店価格の極値,時間要因を組み合わせて,統計的変動率を計算します. この変動率は,資産価格の変動性を反映します.
一定の時間周期における最高値,最低値,閉店価格の極値を計算する.
極限値法公式を適用して統計変動率を計算する
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")