双交差移動平均逆転戦略

作者: リン・ハーンチャオチャン,日付: 2023-11-21 11:28:27
タグ:

imgこの記事の内容は,私があなたの要求に応えて書いた記事です.

概要

この戦略は123逆転パターン戦略とベアパワー指標戦略を組み合わせます.両方が同じ方向に買いまたは売るシグナルを与えるときに取引信号が生成されます.これはブレイクアウト逆転取引戦略に属します.

戦略の論理

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

  1. 123 逆転パターン戦略

    収束価格が2日連続で下落し,低ストック指標が低水準から反転すると買い信号を生成し,収束価格が2日連続で上昇し,高ストック指標が高水準から引き戻したとき売れ信号を生成する.

  2. 熊の力指標戦略

    Bear Power インディケーターは,バリーッシュとベアッシュの力を比較する指標です.設定されたセールラインの上ではセールシグナル,設定された購入ライン下では購入シグナルを生成します.

シグナルを組み合わせると,両者が同じ方向にシグナルを送る場合,実際の取引シグナルが生成されます.

利点

  1. 逆転信号とインジケーターフィルターを組み合わせることで 偽ブレイクを回避し 信号の質を向上させます

  2. 複数のタイムフレームに適用可能で,異なる市場環境に適応する柔軟性があります.

  3. 構成戦略は単体またはモジュール式設計で組み合わせて使用できます.

リスク

  1. 逆転信号は 大きな引き戻り深さに直面する可能性があります

  2. ベアパワー指標のパラメータは 繰り返しテストと最適化が必要です

  3. 多要素統合戦略には複雑なパラメータ調整があり,テストのために大量の歴史的データが必要です.

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

  1. より長い時間帯とより豊かなデータセットを得るために,より多くのデータソースを join Quant モジュールで接続します.

  2. マシン学習方法を適用し,パラメータの組み合わせを自動的に検索して評価する.

  3. ストップ・ロスのメカニズムを追加し,単一の取引損失を制御します.

結論

この戦略は,反転技術分析と定量指標を組み合わせ,ダブル確認を通じて信号品質を改善する.高モジュール性と拡張性がある.先進技術によるさらなる最適化により,より洗練された市場環境に適応することができる.


/*backtest
start: 2023-11-13 00:00:00
end: 2023-11-20 00:00:00
period: 10m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

//@version=3
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 29/05/2019
// This is combo strategies for get 
// a cumulative signal. Result signal will return 1 if two strategies 
// is long, -1 if all strategies is short and 0 if signals of strategies is not equal.
//
// 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
//  Bear Power Indicator
//  To get more information please see "Bull And Bear Balance Indicator" 
//  by Vadim Gimelfarb. 
//
// 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

BearPower(SellLevel, BuyLevel) =>
    value =  iff (close < open ,  
              iff (close[1] > open ,  max(close - open, high - low), high - low), 
               iff (close > open, 
                 iff(close[1] > open, max(close[1] - low, high - close), max(open - low, high - close)), 
                  iff(high - close > close - low, 
                   iff (close[1] > open, max(close[1] - open, high - low), high - low), 
                     iff (high - close < close - low, 
                      iff(close > open, max(close - low, high - close),open - low), 
                       iff (close > open, max(close[1] - open, high - close),
                         iff(close[1] < open, max(open - low, high - close), high - low))))))
    pos = 0.0
    pos := iff(value > SellLevel, -1,
	   iff(value <= BuyLevel, 1, nz(pos[1], 0))) 

    pos

strategy(title="Combo Backtest 123 Reversal & Bear 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)
//-------------------------
SellLevel = input(30)
BuyLevel = input(3)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posBearPower = BearPower(SellLevel, BuyLevel)
pos = iff(posReversal123 == 1 and posBearPower == 1 , 1,
	   iff(posReversal123 == -1 and posBearPower == -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 ? red: possig == 1 ? green : blue ) 

もっと