価格変動の平均逆転戦略

作者: リン・ハーンチャオチャン開催日:2023年10月11日 16:03:36
タグ:

概要

この戦略は,価格変動の標準偏差を計算することによって価格逆転の機会を検出する.異常な価格変動がある場合,それは価格逆転の機会とみなされ,逆転取引ポジションが取られる.

原則

戦略は2つの主要指標を使用します.

  1. VixFix指標: 特定の期間における価格標準偏差を計算し,異常な価格波動性があるかどうかを判断する. 具体的な計算は:
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl) 
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev 
upperBand = midLine + sDev

価格変動は,wvfが価格変動,sDevが標準偏差,ミッドラインが平均線,下帯と上帯が下線と上限線である.価格が上限線を超えると,異常変動とみなされる.

  1. RSI指標: 価格逆転のタイミングを決定するために価格の相対強度指数を計算します. 計算は:
fastup = rma(max(change(close), 0), 7)
fastdown = rma(-min(change(close), 0), 7) 
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

RSIが値を下回ると,過剰販売状態と潜在的な反発を示します.RSIが値を下回ると,過剰購入状態と潜在的な反発を示します.

入国と出国

入口と出口の論理は

ロング エントリー:価格が上限を超えたり,波動性が限界を超えたり,RSIが値を下回るとロング エントリー.

ショートエントリー:価格が上限を超えたり,波動が限界を超えたり,RSIが値を超えたとき,ショートエントリーします.

出口:キャンドルスタイルの体方向が位置方向とは反対である場合,閉じる位置.

利点

  • 格差値変動の統計特性を用い,幅広く価格逆転を決定する.
  • RSIと組み合わせて買い過ぎ/売過ぎを判断すると入場精度が向上します
  • 低偏差帯を入力信号として割ると 逃した機会が減ります
  • ストップ・ロスのようにキャンドルスタイルのボディを逆転させると,ストップ・ロスは迅速なストップ・ロスを実現し,損失を減らすことができます.

リスク

  • 低偏差帯は,パラメータ最適化のために調整が必要かもしれない.
  • 下部帯を割ると 逆転を保証できないし 閉じ込められる危険性もある
  • RSIのパラメータは最適化が必要で 不適切な値は不正確な信号につながります
  • カンデスタイルのボディストップ損失は 攻撃的すぎるかもしれない 調整が必要だ

オプティマイゼーションの方向性

  • 標準偏差の計算期間を最適化して異常波動性をより良く把握する.
  • RSI パラメータを最適化して,よりよい過買い/過売基準を見つけます.
  • KDJやMACDなどの他の指標を組み合わせて 逆転タイミングを決定してみてください
  • ストップ・ロスのメカニズムを最適化し ストップ・ロスの基準として 価格のリトラセーションを設定します

結論

この戦略は,価格変動の標準偏差を計算することによって,逆転機会を把握することで,異常価格変動を検出する.RSIは,エントリー精度を向上させるためにオーバーバイト/オーバーセール状態を判断するために組み合わせられる.シンプルなキャンドルスタイヤボディ方向ストップロスは使用される.全体として,この戦略は,異常変動を検出するために統計データを有効に使用しているが,安定性を向上させるためにさらなるパラメータ最適化が必要である.ストップロスのメカニズムが損失を減らすために合理的に最適化できれば,戦略はさらにうまく機能する.


/*backtest
start: 2022-10-04 00:00:00
end: 2023-10-10 00:00:00
period: 2d
basePeriod: 1d
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//Noro
//2018

//@version=2
strategy(title = "Noro's VixFix + RSI Strategy v1.0", shorttitle = "VixFix + RSI str 1.0", overlay = true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, pyramiding = 5)

//Settings
needlong = input(true, defval = true, title = "Long")
needshort = input(true, defval = true, title = "Short")
leverage = input(1, defval = 1, minval = 1, maxval = 100, title = "leverage")
limit = input(40, defval = 40, minval = 2, maxval = 50, title = "RSI Limit")

pd = input(22, title="LookBack Period Standard Deviation High")
bbl = input(20, title="Bolinger Band Length")
mult = input(2.0, minval = 1, maxval = 5, title = "Bollinger Band Standard Devaition Up")
lb = input(50, title="Look Back Period Percentile High")
ph = input(.85, title="Highest Percentile - 0.90=90%, 0.95=95%, 0.99=99%")
pl = input(1.01, title="Lowest Percentile - 1.10=90%, 1.05=95%, 1.01=99%")
hp = input(false, title="Show High Range - Based on Percentile and LookBack Period?")
sd = input(false, title="Show Standard Deviation Line?")

fromyear = input(1900, defval = 1900, minval = 1900, maxval = 2100, title = "From Year")
toyear = input(2100, defval = 2100, minval = 1900, maxval = 2100, title = "To Year")
frommonth = input(01, defval = 01, minval = 01, maxval = 12, title = "From Month")
tomonth = input(12, defval = 12, minval = 01, maxval = 12, title = "To Month")
fromday = input(01, defval = 01, minval = 01, maxval = 31, title = "From day")
today = input(31, defval = 31, minval = 01, maxval = 31, title = "To day")

//Vix Fix
wvf = ((highest(close, pd)-low)/(highest(close, pd)))*100
sDev = mult * stdev(wvf, bbl)
midLine = sma(wvf, bbl)
lowerBand = midLine - sDev
upperBand = midLine + sDev
rangeHigh = (highest(wvf, lb)) * ph
rangeLow = (lowest(wvf, lb)) * pl

col = wvf >= upperBand or wvf >= rangeHigh ? lime : gray

//RSI
fastup = rma(max(change(close), 0), 7)
fastdown = rma(-min(change(close), 0), 7)
fastrsi = fastdown == 0 ? 100 : fastup == 0 ? 0 : 100 - (100 / (1 + fastup / fastdown))

//Body
body = abs(close - open)
abody = sma(body, 10)

//Signals
up = (wvf >= upperBand or wvf >= rangeHigh) and fastrsi < limit and close < open
dn = (wvf >= upperBand or wvf >= rangeHigh) and fastrsi > (100 - limit) and close > open
exit = ((strategy.position_size > 0 and close > open) or (strategy.position_size < 0 and close < open)) and body > abody / 3

//Trading
lot = strategy.position_size == 0 ? strategy.equity / close * leverage : lot[1]

if up
    if strategy.position_size < 0
        strategy.close_all()
        
    strategy.entry("Bottom", strategy.long, needlong == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))

if dn
    if strategy.position_size > 0
        strategy.close_all()
        
    strategy.entry("Top", strategy.short, needshort == false ? 0 : lot, when=(time > timestamp(fromyear, frommonth, fromday, 00, 00) and time < timestamp(toyear, tomonth, today, 23, 59)))
    
if time > timestamp(toyear, tomonth, today, 23, 59) or exit
    strategy.close_all()

もっと