OumaとApolloのデュアルトラック取引戦略


作成日: 2023-11-02 17:09:35 最終変更日: 2023-11-02 17:09:35
コピー: 3 クリック数: 678
1
フォロー
1617
フォロワー

OumaとApolloのデュアルトラック取引戦略

概要

この戦略は,オルマ指数とアポロ指数2つの主流の技術指標を組み合わせ,多空二線取引を実現する.基本的考え方は,中長線傾向が多頭であると判断されたときに,短線価格の逆転入場機会を探して多頭を構築することであり,中長線傾向が空頭であると判断されたときに,短線価格の反転入場機会を探して空頭を構築することである.

戦略原則

この戦略は50日,200日2つの移動平均を用いて中長線を判断し,50日線が200日線上にあることは多頭線を意味し,逆は空頭線を意味する.

次に,この戦略は,ショートラインの価格反転の機会を特定するためにオーマ指数を使用する.オーマ指数は,それぞれ%K線と%D線を構成し,単純な移動平均の平滑処理を受けたRSI指数の結果である.%K線が超売区 (80以上) から下方へ突破すると,価格が超買状態から反弹下方へ移行することを示す空頭選択のタイミングである.%K線が超売区 (80以下) から上方へ突破すると,価格が超売区から反弹することを示す%D線を突破すると,多頭選択のタイミングである.

さらに,誤報の機会をさらにフィルターするために,この戦略はアポロ指標を導入した.アポロ指標はK線%Dの値の極限点情報を表示している.%K線が新しい低点を形成すると,反弹力が弱いことを意味する.新しい高点を形成すると,反弹力が強いことを意味する.オーマ指標のシグナルと組み合わせると,入場の精度をさらに向上させることができる.

具体的には,多頭トレンドでは,この戦略は,オルマ指標が超売区の下を突破して多頭チャンスが形成され,同時に新しい高点情報をチェックし,反弹の強さを確認する.空頭トレンドでは,この戦略は,オルマ指標が超買区上を突破して空頭チャンスが形成され,同時に新しい低点情報をチェックし,反弹の強さを確認する.

上述のプロセスにより,この戦略は中長線のトレンド判断と短線の反転指標の優位性を充分に活用し,安定した多空二線取引システムを構築した.

戦略的優位性

  1. この戦略は,トレンド判断と逆転指標を組み合わせ,トレンド取引と逆転取引の利点を兼ね,安定した混合取引の枠組みを形成する.

  2. 双指数フィルタリングにより,誤報率を低減し,信号の信頼性を高めることができる.

  3. 戦略パラメータは単純で,理解しやすく,最適化され,量化取引に適しています.

  4. 戦略は安定して実行され,優れた勝利率と利益比率の特徴があります.

  5. 多空双線方式により,単一方向に限定されない取引機会を継続的に獲得できます.

戦略リスク

  1. 逆転の戦略として,トレンドが変化すると,一連の損失が生じることがあります.

  2. この戦略は,トレーダーの感情制御の要求が高く,一定の撤回比率を承受する必要があります.

  3. 移動平均周期などの部分パラメータには一定の主観性があり,反省最適化によって適切なパラメータを決定する必要がある.

  4. オルマ指数とアポロ指数は,異常波動器に対してある種の感受性があり,極端な状況では失効する可能性があります.

  5. この戦略は,変動する市場環境に適しており,傾向が顕著な状況では効果が低下する可能性があります.

移動平均周期を適切に調整することでトレンドフィルタを導入し,ストップ・ストップ・ストップ戦略を付加することでリスクを回避できます.市場が明らかなトレンドに入るとき,戦略を一時停止して,その環境での取引を回避することを考えることができます.

戦略最適化の方向性

  1. 異なるパラメータの組み合わせをテストして,よりよいパラメータ設定を得る.例えば,EWMAのスムーズな移動平均などの指標を試すことができます.

  2. VolumeやBVなどの指標を足して偏離を判断することで,信号の信頼性をさらに検証できる.

  3. VIXなどのパニック指数を監視指標として加え,市場のパニック時にポジションを下げる.

  4. ATRストップなどのダイナミックストップ方法など,ストップストップ戦略を最適化します.

  5. 機械学習アルゴリズムを導入し,パラメータ設定を動的に最適化する.

  6. 信号の質を向上させるため,多要素モデルを組み込む.

要約する

この戦略は,全体として安定的で効率的な量化取引戦略である.これは,トレンド判断と反転指標を組み合わせ,オーマ指数とアポロ指数の二重検証方法を採用し,ショートライン価格反転の機会を効果的に発見することができる.この戦略の形式は,トレンドシステムまたは反転システムを単独で使用するよりも,より堅牢であり,取り戻しの制御も優れている.これは推奨される量化取引戦略である.もちろん,ユーザーは,その中のリスクポイントに注意する必要があります.パラメータ最適化,損失停止,環境識別などの方法によってリスクを制御し,戦略を最適化します.

ストラテジーソースコード
/*backtest
start: 2023-10-25 00:00:00
end: 2023-10-28 00:00:00
period: 5m
basePeriod: 1m
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/
// © PtGambler

//@version=5
strategy("2 EMA + Stoch RSI + ATR [Pt]", shorttitle = "2EMA+Stoch+ATR", overlay=true, initial_capital = 10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100, calc_on_order_fills = false, max_bars_back = 500)

// ********************************** Trade Period / Strategy Setting **************************************
startY = input(title='Start Year', defval=2011, group = "Backtesting window")
startM = input.int(title='Start Month', defval=1, minval=1, maxval=12, group = "Backtesting window")
startD = input.int(title='Start Day', defval=1, minval=1, maxval=31, group = "Backtesting window")
finishY = input(title='Finish Year', defval=2050, group = "Backtesting window")
finishM = input.int(title='Finish Month', defval=12, minval=1, maxval=12, group = "Backtesting window")
finishD = input.int(title='Finish Day', defval=31, minval=1, maxval=31, group = "Backtesting window")
timestart = timestamp(startY, startM, startD, 00, 00)
timefinish = timestamp(finishY, finishM, finishD, 23, 59)

// ******************************************************************************************

group_ema = "EMA"
group_stoch = "Stochastic RSI"
group_atr = "ATR Stoploss Finder"

// ----------------------------------------- 2 EMA -------------------------------------

ema1_len = input.int(50, "EMA Length 1", group = group_ema)
ema2_len = input.int(200, "EMA Length 2", group = group_ema)

ema1 = ta.ema(close, ema1_len)
ema2 = ta.ema(close, ema2_len)

plot(ema1, "ema1", color.white, linewidth = 2)
plot(ema2, "ema2", color.orange, linewidth = 2)

ema_bull = ema1 > ema2
ema_bear = ema1 < ema2


// -------------------------------------- Stochastic RSI -----------------------------

smoothK = input.int(3, "K", minval=1, group = group_stoch)
smoothD = input.int(3, "D", minval=1, group = group_stoch)
lengthRSI = input.int(14, "RSI Length", minval=1, group = group_stoch)
lengthStoch = input.int(14, "Stochastic Length", minval=1, group = group_stoch)
src = close
rsi1 = ta.rsi(src, lengthRSI)
k = ta.sma(ta.stoch(rsi1, rsi1, rsi1, lengthStoch), smoothK)
d = ta.sma(k, smoothD)

var trigger_stoch_OB = k > 80
var trigger_stoch_OS = k < 20

stoch_crossdown = ta.crossunder(k, d)
stoch_crossup = ta.crossover(k, d)

P_hi = ta.pivothigh(k,1,1)
P_lo = ta.pivotlow(k,1,1)

previous_high = ta.valuewhen(P_hi, k, 1)
previous_low = ta.valuewhen(P_lo, k, 1)
recent_high = ta.valuewhen(P_hi, k, 0)
recent_low = ta.valuewhen(P_lo, k, 0)

// --------------------------------------- ATR stop loss finder ------------------------

length = input.int(title='Length', defval=14, minval=1, group = group_atr)
smoothing = input.string(title='Smoothing', defval='EMA', options=['RMA', 'SMA', 'EMA', 'WMA'], group = group_atr)
m = input.float(0.7, 'Multiplier', step = 0.1, group = group_atr)
src1 = input(high, "Source for upper band", group = group_atr)
src2 = input(low, "Source for lower band", group = group_atr)

showatr = input.bool(true, 'Show ATR Bands', group = group_atr)
collong = input.color(color.purple, 'Long ATR SL', inline='1', group = group_atr)
colshort = input.color(color.purple, 'Short ATR SL', inline='2', group = group_atr)

ma_function(source, length) =>
    if smoothing == 'RMA'
        ta.rma(source, length)
    else
        if smoothing == 'SMA'
            ta.sma(source, length)
        else
            if smoothing == 'EMA'
                ta.ema(source, length)
            else
                ta.wma(source, length)

a = ma_function(ta.tr(true), length) * m
up = ma_function(ta.tr(true), length) * m + src1
down = src2 - ma_function(ta.tr(true), length) * m

p1 = plot(showatr ? up : na, title='ATR Short Stop Loss', color=colshort)
p2 = plot(showatr ? down : na, title='ATR Long Stop Loss', color=collong)

// ******************************* Profit Target / Stop Loss *********************************************

RR = input.float(2.0, "Reward to Risk ratio (X times SL)", step = 0.1, group = "Profit Target")

var L_PT = 0.0
var S_PT = 0.0
var L_SL = 0.0
var S_SL = 0.0

BSLE = ta.barssince(strategy.opentrades.entry_bar_index(0) == bar_index)

if strategy.position_size > 0 and BSLE == 1
    L_PT := close + (close-down)*RR
    L_SL := L_SL[1]
    S_PT := close - (up - close)*RR
    S_SL := up
else if strategy.position_size < 0 and BSLE == 1
    S_PT := close - (up - close)*RR
    S_SL := S_SL[1]
    L_PT := close + (close-down)*RR
    L_SL := down
else if strategy.position_size != 0
    L_PT := L_PT[1] 
    S_PT := S_PT[1]
else
    L_PT := close + (close-down)*RR
    L_SL := down
    S_PT := close - (up - close)*RR
    S_SL := up

entry_line = plot(strategy.position_size != 0 ? strategy.opentrades.entry_price(0) : na, "Entry Price", color.white, linewidth = 1, style = plot.style_linebr)

L_PT_line = plot(strategy.position_size > 0 and BSLE > 0 ? L_PT : na, "L PT", color.green, linewidth = 2, style = plot.style_linebr)
S_PT_line = plot(strategy.position_size < 0 and BSLE > 0 ? S_PT : na, "S PT", color.green, linewidth = 2, style = plot.style_linebr)

L_SL_line = plot(strategy.position_size > 0 and BSLE > 0 ? L_SL : na, "L SL", color.red, linewidth = 2, style = plot.style_linebr)
S_SL_line = plot(strategy.position_size < 0 and BSLE > 0 ? S_SL : na, "S SL", color.red, linewidth = 2, style = plot.style_linebr)

fill(L_PT_line, entry_line, color = color.new(color.green,90))
fill(S_PT_line, entry_line, color = color.new(color.green,90))
fill(L_SL_line, entry_line, color = color.new(color.red,90))
fill(S_SL_line, entry_line, color = color.new(color.red,90))


// ---------------------------------- strategy setup ------------------------------------------------------

var L_entry_trigger1 = false
var S_entry_trigger1 = false

L_entry_trigger1 := ema_bull and close < ema1 and k < 20 and strategy.position_size == 0
S_entry_trigger1 := ema_bear and close > ema1 and k > 80 and strategy.position_size == 0

L_entry1 = L_entry_trigger1[1] and stoch_crossup and recent_low > previous_low
S_entry1 = S_entry_trigger1[1] and stoch_crossdown and recent_high < previous_high

//debugging
plot(L_entry_trigger1[1]?1:0, "L Entry Trigger")
plot(stoch_crossup?1:0, "Stoch Cross Up")
plot(recent_low > previous_low?1:0, "Higher low")

plot(S_entry_trigger1[1]?1:0, "S Entry Trigger")
plot(stoch_crossdown?1:0, "Stoch Cross down")
plot(recent_high < previous_high?1:0, "Lower high")

if L_entry1
    strategy.entry("Long", strategy.long)

if S_entry1
    strategy.entry("Short", strategy.short)

strategy.exit("Exit Long", "Long", limit = L_PT, stop = L_SL, comment_profit = "Exit Long, PT hit", comment_loss = "Exit Long, SL hit")
strategy.exit("Exit Short", "Short", limit = S_PT, stop = S_SL, comment_profit = "Exit Short, PT hit", comment_loss = "Exit Short, SL hit")

//resetting triggers
L_entry_trigger1 := L_entry_trigger1[1] ? L_entry1 or ema_bear or S_entry1 ? false : true : L_entry_trigger1
S_entry_trigger1 := S_entry_trigger1[1] ? S_entry1 or ema_bull or L_entry1 ? false : true : S_entry_trigger1

//Trigger zones
bgcolor(L_entry_trigger1 ? color.new(color.green ,90) : na)
bgcolor(S_entry_trigger1 ? color.new(color.red,90) : na)