
この戦略は123反転とSMA弾力振動器の2つの子戦略を融合させ,双軌道のフィルタリング信号のトレンド追跡戦略を形成する.123反転戦略はK線形状によって潜在的な転換点を判断する.SMA弾力振動器は移動平均を使用してトレンドの方向を決定する.両者は相互検証し,二重確認機構を形成し,誤った信号を効果的にフィルタリングし,より強いトレンドの方向を捕捉し,トレンド追跡取引を実現する.
この戦略は,ウルフ・ジェンセンの『将来市場での3倍返済をどのように得るか』のP183のシステムに由来する.反転型の戦略である.閉盘価格が前日の閉盘価格より2日連続で,そして9日目のランダムな指標の慢線が50以下であるとき,多作する.閉盘価格が前日の閉盘価格より2日連続で,そして9日目のランダムな指標の快線が50以上であるとき,空作る.
この指標は,ウィリアム・ブラウが開発したTSI指標に似ているが,SMA振動器には信号線が含まれている.SMA弾性指標は,前日の価格の二重移動平均を引いた価格を使用し,SMAの指数移動平均を信号線として描画し,取引信号を発信する.指標のパラメータを調整して最適化することができる.
二重確認:123反転とSMA弾力指数が同方向の信号を発したときにのみ,ポジションを開く.両者の信号方向が一致しないときは,空のポジションを保持する.
複数の指標を融合させ,二重確認メカニズムを形成し,誤信号を効果的にフィルターする.
123逆転策略は,K線形状を利用して潜在的な逆転点を判断する.SMA弾性振動器は,トレンドを判断して信号を発信し,両者は相互に検証し,単一の指標の不足を補う.
SMA弾性振動器のパラメータは調整可能で,異なる品種と周期に最適化され,柔軟性がある.
全体的に,トレンド追跡戦略として,順番に,継続的に強い勢いの方向を捉えることができます.
逆転戦略とトレンド戦略の統合とバランスは,常に最適化されていなければ,ターニングポイントを逃すか,大きな損失を生む可能性があります.
逆転策には,誤った取引のリスクがあり,失敗率を下げるためにパラメータを調整する必要があります.
純粋な追跡戦略ではトレンドの逆転点を判断することができない.潜在的損失リスクがある.適時にポジションを減らし,リスクを回避する必要がある.
異なる品種と周期パラメータは,繰り返し最適化テストを必要とし,生搬硬套は不適宜である.
123の逆転のパラメータを調整し,誤った取引の頻度を下げます.
SMA弾性振動器のパラメータを調整し,指標の感度を最適化する.
単発損失を減らすためのストップ・ロース戦略を追加する.
リスクの逆転を判断し,適切なタイミングでポジションを減額する.
異なる品種のパラメータを最適化して安定性を向上させるテスト.
この戦略は,反転とトレンドの戦略の優位性を統合する二重確認機構を使用して,より強力なトレンド追跡効果を形成する. 効率的にノイズを除し,順調に,継続的に優良なトレンドの機会を捕捉することができる. 同時に,一定の撤回リスクも存在し,パラメータを継続的に最適化してリスクを制御する必要があります.
/*backtest
start: 2022-10-30 00:00:00
end: 2023-02-03 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
////////////////////////////////////////////////////////////
// Copyright by HPotter v1.0 14/07/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 SMI Ergodic Indicator is the same as the True Strength Index (TSI) developed by
// William Blau, except the SMI includes a signal line. The SMI uses double moving averages
// of price minus previous price over 2 time frames. The signal line, which is an EMA of the
// SMI, is plotted to help trigger trading signals. Adjustable guides are also given to fine
// tune these signals. The user may change the input (close), method (EMA), period lengths
// and guide values.
//
// 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
SMI_Erg(fastPeriod, slowPeriod,SmthLen, TopBand,LowBand) =>
pos = 0.0
xPrice = close
xPrice1 = xPrice - xPrice[1]
xPrice2 = abs(xPrice - xPrice[1])
xSMA_R = ema(ema(xPrice1,fastPeriod),slowPeriod)
xSMA_aR = ema(ema(xPrice2, fastPeriod),slowPeriod)
xSMI = xSMA_R / xSMA_aR
xEMA_SMI = ema(xSMI, SmthLen)
pos:= iff(xEMA_SMI < LowBand, -1,
iff(xEMA_SMI > TopBand, 1, nz(pos[1], 0)))
pos
strategy(title="Combo Backtest 123 Reversal & SMI Ergodic Oscillator", 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, "---- SMI Ergodic Oscillator ----")
fastPeriod = input(4, minval=1)
slowPeriod = input(8, minval=1)
SmthLen = input(3, minval=1)
TopBand = input(0.5, step=0.1)
LowBand = input(-0.5, step=0.1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posSMI_Erg = SMI_Erg(fastPeriod, slowPeriod,SmthLen, TopBand,LowBand )
pos = iff(posReversal123 == 1 and posSMI_Erg == 1 , 1,
iff(posReversal123 == -1 and posSMI_Erg == -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 )