オシレーター取引戦略


作成日: 2023-12-13 14:45:51 最終変更日: 2023-12-13 14:45:51
コピー: 0 クリック数: 795
1
フォロー
1621
フォロワー

オシレーター取引戦略

概要

これは,複数の技術指標に基づいた反転取引戦略である. CCI,動向指標,RSIなどの指標を組み合わせて,潜在的な多頭と空頭取引の機会を識別する. 指標がオーバーバイのオーバーセール信号を示し,価格が反調したときに,この戦略は取引信号を発する.

戦略原則

この戦略の取引信号は,カスタマイズされた指数のEdri極点の買取指数から得られ,CCI,運動指数とRSIの交差を総合的に考慮する.具体的論理は:

多頭信号条件:

  1. Edri 極点買出点指数は,CCI 上の0軸または動力指数上の0軸を貫通し,RSI が超売り線より低い買入信号を発する.
  2. 価格が100サイクルEMAより下がった.

空頭信号条件:

  1. Edri ポイントバイズ ポイントバイズ 指数は,CCI 下の0軸または,動力指数の下の0軸を突破し,RSI が超買線より高いという売り込み信号を発している.
  2. 価格が100サイクルEMAより下がったり上昇したりする.

この策略は,RSIと価格との明らかな偏差が取引信号を発生させるための条件である通常の偏差を探すために配置することも選択できます.

取引シグナルが満たされると,戦略のストップ・ロスは入場価格±2ATR,ストップ・ロスは入場価格±4ATRである.これは,市場の波動程度に応じて合理的なストップ・ロスの範囲を設定することができる.

優位分析

  1. 複数の指標を統合して判断することで,単一の指標の誤信号を回避できます.
  2. 逆転取引法により,変動の際に短期取引の機会を捉えることができます.
  3. ATRのストップ・ストップ方式は,市場の波動性によるインテリジェントの調整を行うことができる.
  4. 偏差条件を探して,極端でないオーバーバイ・オーバーセール状況でポジションを開くのを避ける.

リスク分析

  1. 指数のパラメータを正しく設定しない場合,取引機会が失われ,誤った信号が過剰に発生する可能性があります.
  2. 逆転取引モデルは,トレンドの動きの中で連続して止まる可能性があります.
  3. ATRは遅滞性があり,急激に変化する市場において,時効的にストップ・ローズ・ストップ・ポイントを更新することができない.

解決策は

  1. 指標パラメータを繰り返しテストし,最適化して,最適なパラメータの組み合わせを見つけます.
  2. 傾向が強い場合は,この戦略を一時的に使用することを検討してください.
  3. 移動停止または逆停止などの他の停止方法と組み合わせる.

最適化の方向

  1. 異なるパラメータの組み合わせをテストします.例えばCCIとモーターサイクル,RSIパラメータ,ATR倍数などです.
  2. 価格パターン,取引量変化など,他の補助フィルタリング条件を追加します.
  3. ポジション管理方法を調整します.例えば,ATR値に基づいてポジションの比率を設定します.
  4. 異なる品種,周期のパラメータのテンプレートを設定します.
  5. トレンドトラッキングの仕組みと組み合わせた反転取引を,トレンド状況で停止することを検討する.

要約する

この戦略は,主に振動的な状況で適用され,中短線反転を捕獲することによってより安定した収益を得ます.それは,価格の短期的な伸縮現象を認識するのに役立ちます.そして,複数の指標に基づいて取引信号を生成します.合理的なパラメータ最適化とリスク管理により,この戦略の優位性を効果的に利用できます.しかし,反転取引に固有の不足,強い傾向下での継続的な損失の可能性に注意する必要があります.全体的に,この戦略は,定量化とリスク管理の経験を持つ投資家に適しています.

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

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © MagicStrategies

//@version=5
strategy("Reversal Indicator Strategy", overlay = true)

// Input settings
ccimomCross = input.string('CCI', 'Entry Signal Source', options=['CCI', 'Momentum'], tooltip='CCI or Momentum will be the final source of the Entry signal if selected.')
ccimomLength = input.int(10, minval=1, title='CCI/Momentum Length')
useDivergence = input.bool(true, title='Find Regular Bullish/Bearish Divergence', tooltip='If checked, it will only consider an overbought or oversold condition that has a regular bullish or bearish divergence formed inside that level.')
rsiOverbought = input.int(65, minval=1, title='RSI Overbought Level', tooltip='Adjusting the level to extremely high may filter out some signals especially when the option to find divergence is checked.')
rsiOversold = input.int(35, minval=1, title='RSI Oversold Level', tooltip='Adjusting this level extremely low may filter out some signals especially when the option to find divergence is checked.')
rsiLength = input.int(14, minval=1, title='RSI Length')
plotMeanReversion = input.bool(false, 'Plot Mean Reversion Bands on the chart', tooltip='This function doesn\'t affect the entry of signal but it suggests buying when the price is at the lower band, and then sell it on the next bounce at the higher bands.')
emaPeriod = input(200, title='Lookback Period (EMA)')
bandMultiplier = input.float(1.8, title='Outer Bands Multiplier', tooltip='Multiplier for both upper and lower bands')


// CCI and Momentum calculation
momLength = ccimomCross == 'Momentum' ? ccimomLength : 10
mom = close - close[momLength]
cci = ta.cci(close, ccimomLength)
ccimomCrossUp = ccimomCross == 'Momentum' ? ta.cross(mom, 0) : ta.cross(cci, 0)
ccimomCrossDown = ccimomCross == 'Momentum' ? ta.cross(0, mom) : ta.cross(0, cci)

// RSI calculation
src = close
up = ta.rma(math.max(ta.change(src), 0), rsiLength)
down = ta.rma(-math.min(ta.change(src), 0), rsiLength)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - 100 / (1 + up / down)
oversoldAgo = rsi[0] <= rsiOversold or rsi[1] <= rsiOversold or rsi[2] <= rsiOversold or rsi[3] <= rsiOversold
overboughtAgo = rsi[0] >= rsiOverbought or rsi[1] >= rsiOverbought or rsi[2] >= rsiOverbought or rsi[3] >= rsiOverbought

// Regular Divergence Conditions
bullishDivergenceCondition = rsi[0] > rsi[1] and rsi[1] < rsi[2]
bearishDivergenceCondition = rsi[0] < rsi[1] and rsi[1] > rsi[2]

// Entry Conditions
longEntryCondition = ccimomCrossUp and oversoldAgo and (not useDivergence or bullishDivergenceCondition)
shortEntryCondition = ccimomCrossDown and overboughtAgo and (not useDivergence or bearishDivergenceCondition)


// Mean Reversion Indicator
meanReversion = plotMeanReversion ? ta.ema(close, emaPeriod) : na
stdDev = plotMeanReversion ? ta.stdev(close, emaPeriod) : na
upperBand = plotMeanReversion ? meanReversion + stdDev * bandMultiplier : na
lowerBand = plotMeanReversion ? meanReversion - stdDev * bandMultiplier : na


// Plotting
plotshape(longEntryCondition, title='BUY', style=shape.triangleup, text='B', location=location.belowbar, color=color.new(color.lime, 0), textcolor=color.new(color.white, 0), size=size.tiny)
plotshape(shortEntryCondition, title='SELL', style=shape.triangledown, text='S', location=location.abovebar, color=color.new(color.red, 0), textcolor=color.new(color.white, 0), size=size.tiny)

plot(upperBand, title='Upper Band', color=color.new(color.fuchsia, 0), linewidth=1)
plot(meanReversion, title='Mean', color=color.new(color.gray, 0), linewidth=1)
plot(lowerBand, title='Lower Band', color=color.new(color.blue, 0), linewidth=1)

// Entry signal alerts
alertcondition(longEntryCondition, title='BUY Signal', message='Buy Entry Signal')
alertcondition(shortEntryCondition, title='SELL Signal', message='Sell Entry Signal')
alertcondition(longEntryCondition or shortEntryCondition, title='BUY or SELL Signal', message='Entry Signal')

ema100 = ta.ema(close, 100)
plot(ema100, color=color.red)

// Define trading signals based on the original indicator's entry conditions
// Buy if long condition is met and price has pulled back to or below the 100 EMA
longCondition  = longEntryCondition and close <= ema100
// Sell if short condition is met and price has pulled back to or above the 100 EMA
shortCondition = shortEntryCondition and close >= ema100

// Strategy Entries
if longCondition
    strategy.entry("Buy", strategy.long)
if shortCondition
    strategy.entry("Sell", strategy.short)