量子取引のダブルクリック逆転戦略

作者: リン・ハーンチャオチャン開催日:2023年11月22日 (火) 10:03:04
タグ:

img

概要

この戦略はまず123パターンを用いて逆転信号を決定し,その後クリンガー・ボリューム・オシレーターをフィルターとして組み合わせてダブルクリック量的な利益戦略を実装し,逆転機会を効率的に把握します.

原則

戦略は2つの部分からなる.

  1. 逆転シグナルを決定するパターン: 閉店価格が2日間連続して下がり,3日目にはポジティブで閉店し,ストック指標が長期的に低水準にあるとき; 閉店価格が2日間連続して上昇し,3日目にはマイナスで閉店し,ストック指標が短期的に高水準にあるとき.

  2. クリンガー・ボリューム・オシレーターセクション: クリンガー・ボリューム・オシレーターは,価格変動範囲と取引量の変化を組み合わせて,資本の流入と流出を決定する.ボリューム・オシレーターが平均値を超えると,それは長い信号であり,平均値を下回ると,それはショート信号である.

最後に,戦略は上記の2つの部分からの信号とダブルクリックを組み合わせて最終エントリを決定します.

利点分析

この戦略の最大の利点は,逆転パターンとボリュームインジケーターを組み合わせて逆転機会を効率的に捉えることである.さらに,ストックインジケーターの助けで,偽のブレイクアウトを回避し,クリンガーボリュームオシレーターを使用して,実際の資金流の方向性を決定し,正確なエントリータイミングを保証することができる.

リスク分析

この戦略の主なリスクは,逆転パターン判断とパラメータ設定の問題にあります.逆転信号の遅延のために,逆転パターンが失敗する可能性があります.

リスクを軽減するために,逆転信号をより応答性とタイムリー化するためにパラメータを最適化することができます.また,逆転の十分な数と幅を確実にするために,他のフィルターを追加することもできます.

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

この戦略の主な最適化空間は,パラメータ調整と他の補助判断の追加である.特に,123パターン差別の感度を最適化するためにストック指標パラメータを適切に短縮することは可能である.また,MACDの黄金十字や致命的な十字,またはダブルトップ/ボトムマルチボトムなどの判断を追加するなどの現在の主流指標とパターンと組み合わせることも可能である.

さらに,ストップ損失を動的に調整し,市場変化に戦略をより適応できるように利益条件を考慮してください.また,リアルタイムでパラメータを最適化するために機械学習を組み合わせることも可能です.

概要

この戦略は,逆転の機会を効率的に把握するために,古典的な逆転理論とボリューム技術指標の適用を統合しています.最適化のための空間は大きく,効果をさらに改善する可能性があり,実際の取引で検証し,継続的に最適化する必要があります.


/*backtest
start: 2023-10-22 00:00:00
end: 2023-11-21 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 23/12/2020
// 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 Klinger Oscillator (KO) was developed by Stephen J. Klinger. Learning 
// from prior research on volume by such well-known technicians as Joseph Granville, 
// Larry Williams, and Marc Chaikin, Mr. Klinger set out to develop a volume-based 
// indicator to help in both short- and long-term analysis.
// The KO was developed with two seemingly opposite goals in mind: to be sensitive 
// enough to signal short-term tops and bottoms, yet accurate enough to reflect the 
// long-term flow of money into and out of a security.
// The KO is based on the following tenets:
// Price range (i.e. High - Low) is a measure of movement and volume is the force behind 
// the movement. The sum of High + Low + Close defines a trend. Accumulation occurs when 
// today's sum is greater than the previous day's. Conversely, distribution occurs when 
// today's sum is less than the previous day's. When the sums are equal, the existing trend 
// is maintained.
// Volume produces continuous intra-day changes in price reflecting buying and selling pressure. 
// The KO quantifies the difference between the number of shares being accumulated and distributed 
// each day as "volume force". A strong, rising volume force should accompany an uptrend and then 
// gradually contract over time during the latter stages of the uptrend and the early stages of 
// the following downtrend. This should be followed by a rising volume force reflecting some 
// accumulation before a bottom develops.
//
// 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

KVO(TrigLen,FastX,SlowX) =>
    pos = 0.0
    xTrend = iff(hlc3 > hlc3[1], volume * 100, -volume * 100)
    xFast = ema(xTrend, FastX)
    xSlow = ema(xTrend, SlowX)
    xKVO = xFast - xSlow
    xTrigger = ema(xKVO, TrigLen)
    pos := iff(xKVO > xTrigger, 1,
    	     iff(xKVO < xTrigger, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Klinger Volume Oscillator", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
TrigLen = input(13, minval=1)
FastX = input(34, minval=1)
SlowX = input(55, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posKVO = KVO(TrigLen,FastX,SlowX)
pos = iff(posReversal123 == 1 and posKVO == 1 , 1,
	   iff(posReversal123 == -1 and posKVO == -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 )

もっと