
二重確認量化取引戦略は,123反転戦略と百分取引量震動指数 ((PVO)) の2つの子戦略を組み合わせて,取引信号の二重確認を実現し,取引リスクを軽減する.この戦略は,主に中長期線保有取引に適用される.
123反転策は,ランダムな指標K線形状に基づいて実現する.具体的には,閉盘価格が前日の閉盘価格より2日連続で低く,そして9日連続で緩やかなランダムな指標が50より低ければ多めに;閉盘価格が前日の閉盘価格より2日連続で高く,そして9日連続で緩やかなランダムな指標が50より高ければ空いて.
PVOは取引量に基づく動量振動指標である.これは,2つの異なる周期の取引量指数移動平均の差値とより長い周期平均の比率を測定し,パーセントの形で表現する.短期平均が長期平均より高いときは正であり,逆に負である.この指標は取引量の上昇・下降を反映する.
この戦略は,価格指標と取引量指標を組み合わせて,偽の突破を効果的にフィルタリングできます.同時に,二重確認メカニズムを使用して,取引頻度を削減し,取引リスクを減らすことができます.
この戦略は,長期のポジション周期に依存し,撤回リスクがある.また,パラメータの設定を間違えた場合,取引頻度が過高または信号が間違える可能性があります.
ランダムな指標とPVOのパラメータを調整することで,子戦略のパフォーマンスを最適化することができる.また,ストップ・ローズ・メカニズムを導入してリスクを制御することができる.さらに,他の指標のフィルター信号と組み合わせることで,戦略の安定性をさらに向上させることができる.
双重確認量化取引戦略は,価格と取引量要因を総合的に考慮し,反測効果が理想的です.パラメータ調整と最適化信号フィルタリングにより,この戦略は,安定性をさらに強化し,量化取引の強力なツールになる見込みです.
/*backtest
start: 2024-01-07 00:00:00
end: 2024-01-14 00:00:00
period: 15m
basePeriod: 5m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 14/04/2021
// This is combo strategies for get a cumulative signal.
//
// First strategy
// This System was created from the Book "How I Tripled My Money In The
// Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
// The strategy buys at market, if close price is higher than the previous close
// during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
// The strategy sells at market, if close price is lower than the previous close price
// during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
//
// Second strategy
// The Percentage Volume Oscillator (PVO) is a momentum oscillator for volume.
// PVO measures the difference between two volume-based moving averages as a
// percentage of the larger moving average. As with MACD and the Percentage Price
// Oscillator (PPO), it is shown with a signal line, a histogram and a centerline.
// PVO is positive when the shorter volume EMA is above the longer volume EMA and
// negative when the shorter volume EMA is below. This indicator can be used to define
// the ups and downs for volume, which can then be use to confirm or refute other signals.
// Typically, a breakout or support break is validated when PVO is rising or positive.
//
// WARNING:
// - For purpose educate only
// - This script to change bars colors.
////////////////////////////////////////////////////////////
Reversal123(Length, KSmoothing, DLength, Level) =>
vFast = sma(stoch(close, high, low, Length), KSmoothing)
vSlow = sma(vFast, DLength)
pos = 0.0
pos := iff(close[2] < close[1] and close > close[1] and vFast < vSlow and vFast > Level, 1,
iff(close[2] > close[1] and close < close[1] and vFast > vSlow and vFast < Level, -1, nz(pos[1], 0)))
pos
PVO(LengthShortEMA,LengthLongEMA,LengthSignalEMA) =>
pos = 0.0
xShortEMA = ema(volume , LengthShortEMA)
xLongEMA = ema(volume , LengthLongEMA)
xPVO = ((xShortEMA - xLongEMA) / xLongEMA) * 100
xSignalEMA = ema(xPVO , LengthSignalEMA)
xPVOHisto = xPVO - xSignalEMA
pos := iff(xSignalEMA < xPVO, -1,
iff(xSignalEMA > xPVO, 1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & Percentage Volume Oscillator (PVO)", shorttitle="Combo", overlay = true)
line1 = input(true, "---- 123 Reversal ----")
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
line2 = input(true, "---- Percentage Volume OscillatorA ----")
LengthShortEMA = input(12, minval=1)
LengthLongEMA = input(26, minval=1)
LengthSignalEMA = input(9, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPVO = PVO(LengthShortEMA,LengthLongEMA,LengthSignalEMA)
pos = iff(posReversal123 == 1 and posPVO == 1 , 1,
iff(posReversal123 == -1 and posPVO == -1, -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)
if (possig == 0)
strategy.close_all()
barcolor(possig == -1 ? #b50404: possig == 1 ? #079605 : #0536b3 )