この戦略は,Voss予測フィルターとEhlers瞬時トレンドライン指標を統合して,市場の周期的な転換点を識別し,取引を量化します.Vossフィルターは,購入/売却のシグナルを事前に発信し,瞬時トレンドライン指標は,全体的なトレンドの方向を判断し,トレンド市場におけるVossフィルターの誤導を減らすために使用されます.この戦略は,ビットコインなどの周期性がより顕著な品種に用いられ,反省で良好なパフォーマンスを発揮します.
Vossの予測フィルターは,ジョン・F・エラーズの文章『A Peek Into The Future』に由来する.そのフィルターの計算式は次のとおりである.
_filt = 0.5 * _s3 * _x1 + _f1 * _s2 * _filt[1] - _s1 * _filt[2]
_voss = _x2 * _filt - _sumC
その中で_x1は価格の1乗差です._x2は平滑化因子で_s1、_s2、_s3は波パラメータ;_f1は周期関数である._filt はフィルター結果_vossは最終出力として
このフィルターは,平滑フィルターとして見られ,現在と過去数回間の情報を強調し,購入/売却の信号を事前に発信する.内在のグループ・デライスにより,それは,が将来のを覗くように,他の指標より前に予測的な信号を発信できる.
瞬時のトレンドライン指数は以下の式で計算される.
_it = (_a-((_a*_a)/4.0))*_src+0.5*_a*_a*_src[1]-(_a-0.75*_a*_a)*_src[2]+2*(1-_a)*nz(_it[1])+-(1-_a)*(1-_a)*nz(_it[2])
この指標は,価格と最も適合するトレンドラインをリアルタイムで描き,トレンドの方向と強さを正確に判断します.
Vossは負の正転から,上穿過フィルターの結果で買取信号を生成する.
ヴォスは正転負から,下を通過する結果で売り信号を生成する.
同時に,瞬時のトレンドライン指標がトレンドの方向を確認する時のみ,取引信号を発信する.これは,トレンドマーケットでVossフィルタが発信するかもしれない誤った信号をフィルターする.
リスクは以下の方法で軽減できます
この戦略は以下の点で最適化できます.
この戦略は,ヴォスフィルターとトレンド指標を統合して,市場の周期的な逆転点を効果的に識別することができる.パラメータを最適化して,リスクを制御することによって,この戦略は,安定した量化取引システムを実現できる.これは,明らかに周期的な品種に広く適用され,反省で良好な取引効果を示している.全体的に,この戦略は,ユニークな予測能力を持ち,多方面で最適化でき,広範囲の応用展望を有する.
/*backtest
start: 2023-08-19 00:00:00
end: 2023-09-18 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
// A Peek Into the Future
// John F. Ehlers
// TASC Aug 2019
// Created by e2e4mfck for tradingview.com
// Modified by © Bitduke
//@version=4
//strategy("Voss Strategy (Filter + IT)", overlay=false, calc_on_every_tick=false,pyramiding=0, default_qty_type=strategy.cash,default_qty_value=1000, currency=currency.USD, initial_capital=1000,commission_type=strategy.commission.percent, commission_value=0.075)
// voss filter
source = input(close, type = input.source)
period = input(20, type = input.integer)
predict = input(4, type = input.integer)
bandwidth = input(0.25, type = input.float)
// it trendline
src = input(hl2, title="Source IT")
a = input(0.07, title="Alpha", step=0.01)
fr = input(false, title="Fill Trend Region")
ebc = input(false, title="Enable barcolors")
hr = input(false, title="Hide Ribbon")
voss_filter (_period, _predict, _bandwidth, _source) =>
float _filt = 0, float _sumC = 0, float _voss = 0
_PI = 2 * asin(1)
_order = 3 * _predict
_f1 = cos(2 * _PI / _period)
_g1 = cos(_bandwidth * 2 * _PI / _period)
_s1 = 1 / _g1 - sqrt(1 / (_g1 * _g1) - 1)
_s2 = 1 + _s1
_s3 = 1 - _s1
_x1 = _source - _source[2]
_x2 = (3 + _order) / 2
for _i = 0 to (_order - 1)
_sumC := _sumC + ((_i + 1) / _order) * _voss[_order - _i]
if bar_index <= _order
_filt := 0
_voss := 0
else
_filt := 0.5 * _s3 * _x1 + _f1 * _s2 * _filt[1] - _s1 * _filt[2]
_voss := _x2 * _filt - _sumC
[_voss, _filt]
[Voss, Filt] = voss_filter(period, predict, bandwidth, source)
instantaneous_trendline (_src, _a, _freq, _ebc, _hr) =>
_it = 0.0
_it := (_a-((_a*_a)/4.0))*_src+0.5*_a*_a*_src[1]-(_a-0.75*_a*_a)*_src[2]+2*(1-_a )*nz(_it[1], ((_src+2*_src[1]+_src[2])/4.0))-(1-_a)*(1-_a)*nz(_it[2], ((_src+2*_src[1]+_src[2])/4.0))
_lag = 2.0*_it-nz(_it[2])
[_it, _lag]
[it, lag] = instantaneous_trendline(src, a, fr, ebc, hr)
// - - - - - - - - - - //
plot(Filt, title = "Filter", style = plot.style_line, color = color.red, linewidth = 2)
plot(Voss, title = "Voss", style = plot.style_line, color = color.blue, linewidth = 2)
hline(0.0, title = "Zero", linestyle = hline.style_dashed, color = color.black, linewidth = 1)
plot(hr? na:it, title="IT Trend", color= fr? color.gray : color.red, linewidth=1)
plot(hr? na:lag, title="IT Trigger", color=fr? color.gray : color.blue, linewidth=1)
// Strategy Logic
longCondition = lag < it and crossover(Voss,Filt)
shortCondition = it > lag and crossover(Filt,Voss)
strategy.entry("Voss_Short", strategy.short, when=shortCondition)
strategy.entry("Voss_Long", strategy.long, when=longCondition)
// === Backtesting Dates === thanks to Trost
testPeriodSwitch = input(true, "Custom Backtesting Dates")
testStartYear = input(2019, "Backtest Start Year")
testStartMonth = input(1, "Backtest Start Month")
testStartDay = input(1, "Backtest Start Day")
testStartHour = input(0, "Backtest Start Hour")
testPeriodStart = timestamp(testStartYear, testStartMonth, testStartDay, testStartHour, 0)
testStopYear = input(2020, "Backtest Stop Year")
testStopMonth = input(2, "Backtest Stop Month")
testStopDay = input(29, "Backtest Stop Day")
testStopHour = input(0, "Backtest Stop Hour")
testPeriodStop = timestamp(testStopYear, testStopMonth, testStopDay, testStopHour, 0)
testPeriod() =>
time >= testPeriodStart and time <= testPeriodStop ? true : false
testPeriod_1 = testPeriod()
isPeriod = true
// === /END
if not isPeriod
strategy.cancel_all()
strategy.close_all()