反転力戦略


作成日: 2023-11-21 11:36:48 最終変更日: 2023-11-21 11:36:48
コピー: 0 クリック数: 667
1
フォロー
1617
フォロワー

反転力戦略

概要

この戦略は,反転戦略とブリン帯の強い戦略を統合して,組み合わせた取引信号を形成し,トレンド追跡と反転キャプチャの二重機能を実現します.

戦略原則

逆転部分

チュチェンの”How I Triple Profited in the Futures Market”の183ページにある逆転戦略の論理によれば,閉盘価格が前日の閉盘価格より2日連続で高く,そして9日のランダムな指標のスローラインが50を下回ったとき,多めに稼ぐ.閉盘価格が前日の閉盘価格より2日連続で低く,そして9日のランダムな指標のスローラインが50を下回ったとき,空にする.

強い部分

アレキサンダー・アールド博士によるブリン帯強度指標: 13日指数移動平均を用いて市場価値共識を表す.多頭強度指標は,買い手による価値共識より高い価格の駆動能力を反映する.空飛ぶ強度指標は,売り手による価値共識より低い価格の駆動能力を反映する.多頭強度指標は,その日の最高価格減13日指数移動平均,空飛ぶ強度指標は,その日の最低価格減13日指数移動平均として計算される.

この戦略は,強さ指標の値を0に設定します.つまり,強さ指標>0であれば取引信号が生じます.

統合信号

逆転策と強勢策の取引信号が一致するときに,最終的な取引信号が生成されます. 多信号は逆転信号の多看と強勢信号の多看の総合;空調信号は逆転信号の空看と強勢信号の空看の総合です.

優位分析

これは,反転策とトレンド追跡策を同時に使用して取引信号を形成する総合的な戦略であり,反転を捕まえてトレンドを追跡する利点があります.

逆転部分は空跳びの隙間後に逆転の機会をロックすることができる.強気部分は,トレンドが存在する場合にのみポジションを開くことを保証することができる.両者は組み合わせて,偽の突破を効果的にフィルタリングし,被套を避ける.

パラメータ最適化には柔軟性があり,異なる品種と周期に合わせて最適のパラメータ組み合わせを探すことができます.

リスク分析

逆転戦略と強戦略の同時多見または空見の確率は低い.信号発生頻度は低い可能性があり,ある程度の信号希少のリスクがある.

逆転部分では,盤の振動調整を逆転の機会として誤判し,早めにポジションを立てることがある.強気部分では,逆転の機会の一部を逃してしまう可能性がある.両者の組み合わせを使用すると,これらのリスクを一定程度軽減することができる.後期には,3つの判断モジュールを導入し,さらに最適化することを考慮することができる.

最適化の方向

  1. 複数のパラメータの組み合わせを試し,最適なパラメータを探します.
  2. トレンド判断モジュールを追加し,明確なトレンドがない時に繰り返しポジションを確立することを避ける.
  3. 単一損失を抑えるための ストップ・ロスの策略を考える

要約する

この戦略は,トレンド追跡と逆転取引の特徴を兼ね備えている.総合型戦略の者と言える.パラメータ最適化により,良好な安定的な収益を期待できる.同時に,信号の希少性や誤判のリスクを予防するために注意する必要がある.後期には,トレンド判定や止損モジュールなどの面から最適化することができ,戦略の実戦性能をより優れたものにする.

ストラテジーソースコード
/*backtest
start: 2023-10-21 00:00:00
end: 2023-11-20 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 15/06/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
// Developed by Dr Alexander Elder, the Elder-ray indicator measures buying 
// and selling pressure in the market. The Elder-ray is often used as part 
// of the Triple Screen trading system but may also be used on its own.
// Dr Elder uses a 13-day exponential moving average (EMA) to indicate the 
// market consensus of value. Bull Power measures the ability of buyers to 
// drive prices above the consensus of value. Bear Power reflects the ability 
// of sellers to drive prices below the average consensus of value.
// Bull Power is calculated by subtracting the 13-day EMA from the day's High. 
// Bear power subtracts the 13-day EMA from the day's Low.
// You can use in the xPrice any series: Open, High, Low, Close, HL2, HLC3, OHLC4 and ect...
//
// 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

BP(Trigger,Length) =>
    pos = 0
    DayHigh = 0.0
    xPrice = close
    xMA = ema(xPrice,Length)
    DayHigh := iff(dayofmonth != dayofmonth[1], high, max(high, nz(DayHigh[1])))
    nRes = DayHigh - xMA
    pos := iff(nRes > Trigger, 1,
    	     iff(nRes < Trigger, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Strategy 123 Reversal & Elder Ray (Bull Power)", shorttitle="Combo", overlay = true)
Length = input(14, minval=1)
KSmoothing = input(1, minval=1)
DLength = input(3, minval=1)
Level = input(50, minval=1)
//-------------------------
LengthBP = input(13, minval=1)
Trigger = input(0)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBP = BP(Trigger,LengthBP)
pos = iff(posReversal123 == 1 and posBP == 1 , 1,
	   iff(posReversal123 == -1 and posBP == -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 )