123 逆転とフラクタル・カオスオシレーターのコンボ戦略

作者: リン・ハーンチャオチャン, 日付: 2023年11月2日 16時43分41秒
タグ:

img

概要

これは123リバース戦略とフラクタル・カオス・オシレーター戦略を組み合わせて より信頼性の高い取引シグナルを得るコンボ戦略です

戦略の論理

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

  1. 123 逆転戦略

    この戦略は,ウルフ・ジェンセン著の"How I Tripped My Money in The Futures Market" (183ページ) から引用されています.これは逆転型戦略です.論理は以下のとおりです.

    • 閉店価格が2日連続で前回の閉店価格より高く,9日間のスローストック値が50を下回るとロングになります

    • 収束価格が前回の収束価格より 2日連続で低くなって,9日間のストックが50以上になるとショートします

  2. フラクタル・カオス・オシレーター戦略

    FCOは,市場の最も微妙な動きの違いを計算します.その値は -1 から 1 までの変動です.値が高くなるほど,上昇傾向または下落傾向に関係なく傾向が強くなります.

    FCO が高値に達するとロング. FCO が低値に達するとショート. この指標は日中取引に適しています.

両方の戦略の信号が一致すると その方向に取引が行われます

利点分析

  • 逆転とトレンド戦略を組み合わせることで 誤った信号をフィルタリングし 信頼性が向上します

  • 逆転戦略は短期的な逆転の機会を捉え,FCO戦略は中長期の傾向を捉える.

  • 最適化されたストックパラメータは 範囲限定市場での 誤った信号を効果的にフィルターします

  • FCOは市場変動に敏感で 傾向の変化を早期に検出できる.

リスク と 解決策

  • 逆転戦略は大きなトレンド逆転に圧倒される可能性があります パラメータを調整するかトレンド戦略と組み合わせます

  • インディケーター戦略は過剰な信号を生成する可能性があります.パラメータを調整するかフィルタリングインディケーターを追加します.

  • バックテストの結果に基づいてパラメータを最適化して協力を改善します.

  • ストップロスを追加して単一の取引損失を制御します.

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

  • 逆転パラメータの組み合わせをテストして 最適値を見つけます

  • FCOのパラメータをテストして 最適なものを探す

  • 遺伝子アルゴリズムやランダムな森林など

  • さらにフィルター信号に追加する補助指標を追加します.

  • 信号の精度を向上させるために 機械学習モデルを追加します

  • リスク管理メカニズム (ストップ損失,ポジションサイズなど) を導入する.

概要

この戦略は,ポートフォリオ利用を通じて逆転とFCO戦略の強みを組み合わせ,信号品質を改善する.バックテストでは良いパフォーマンスを示しています.パラメータチューニング,指標を追加,リスク管理などのさらなる最適化により,ライブパフォーマンスを改善できます.全体的にこれは研究と適用に値する革新的な戦略です.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 07/10/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 value of Fractal Chaos Oscillator is calculated as the difference between 
// the most subtle movements of the market. In general, its value moves between 
// -1.000 and 1.000. The higher the value of the Fractal Chaos Oscillator, the 
// more one can say that it follows a certain trend – an increase in prices trend, 
// or a decrease in prices trend.
//
//   Being an indicator expressed in a numeric value, traders say that this is an 
// indicator that puts a value on the trendiness of the markets. When the FCO reaches 
// a high value, they initiate the “buy” operation, contrarily when the FCO reaches a 
// low value, they signal the “sell” action. This is an excellent indicator to use in 
// intra-day trading.
//
// 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

fractalUp(pattern) =>
    p = high[pattern+1]
    okl = 1
    okr = 1
    res = 0.0
	for i = pattern to 1
		okl := iff(high[i] < high[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(high[i] < high[i-1] and okr == 1, 1, 0)
	res := iff(okl == 1 and okr == 1, p, res[1])
    res

fractalDn(pattern) =>
    p = low[pattern+1]
    okl = 1
    okr = 1
    res = 0.0
	for i = pattern to 1
		okl := iff(low[i] > low[i+1] and okl == 1 , 1, 0)
	for i = pattern+2 to pattern*2+1
		okr := iff(low[i] > low[i-1] and okr == 1, 1, 0)
	res := iff(okl == 1 and okr == 1, p, res[1])
    res

FCO(Pattern) =>
    pos = 0.0
    xUpper = fractalUp(Pattern) 
    xLower = fractalDn(Pattern)
    xRes = iff(xUpper != xUpper[1], 1, 
             iff(xLower != xLower[1], -1, 0))
    pos := iff(xRes == 1, 1,
             iff(xRes == -1, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Fractal Chaos Oscillator", shorttitle="Combo", overlay = true)
Length = input(15, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
Pattern = input(1, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posFCO = FCO(Pattern)
pos = iff(posReversal123 == 1 and posFCO == 1 , 1,
	   iff(posReversal123 == -1 and posFCO == -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 )

もっと