2つの逆転傾向を追跡する戦略

作者: リン・ハーンチャオチャン開催日:2023年12月13日 18:01:53
タグ:

img

概要

このトレンドトラッキング戦略は,二重の逆転信号を組み合わせます.より信頼性の高いトレンド判断のために価格逆転点を追跡するために123逆転戦略とパフォーマンスインデックス戦略を統合します.

戦略原則

この戦略は2つのサブ戦略で構成されています.

  1. 123 逆転戦略

    逆転信号を判断するために14日間のK線を使用します. 具体的なルールは:

    • 上昇信号: 閉じる価格は前2日間で下落した. 現在のK線閉じる価格は前日の閉じる価格より高い. 9 日ストキャスティック・スローは50以下である.
    • 熊気信号: 閉店価格は前2日間で上昇した. 現在のK線閉店価格は前日の閉店価格よりも低い. 9日ストカスティック・ファストは50以上である.
  2. 業績指数戦略

    過去14日間の増加/減少パーセントを指標として計算します.ルールとは:

    • 業績指数 > (0),上昇信号を生成する -パフォーマンスインデックス <(0),下落信号を生成

最終信号は両方の信号の組み合わせである.つまり,実際の買い/売取引を生成するために,同じ方向の上昇/下落信号が必要である.

信号がより信頼性が高くなります 信号がより信頼性が高くなります

戦略 の 利点

この二重逆転システムには以下の利点があります.

  1. 二重要素を組み合わせることで より信頼性の高い信号
  2. 市場騒音を効果的にフィルタリングし,誤った信号を避ける
  3. 123のパターンは古典的で実用的で 判断し再現するのが簡単です
  4. 業績指数は将来の傾向の方向性を判断できる
  5. 柔軟なパラメータ組み合わせ,さらに最適化することができます

戦略 の リスク

この戦略にはいくつかのリスクもあります:

  1. 突然の逆転を 見逃し,トレンドを完全に把握できない
  2. 二重信号の組み合わせは,より少ない信号につながり,収益性に影響を与える可能性があります.
  3. 一貫した判断が必要で 個々のストック変動に 容易に影響を受けます
  4. パラメータ設定の問題は信号偏差を引き起こす可能性があります.

次の側面は最適化のために考慮することができます:

  1. K線長,ストカスティックサイクルのようなパラメータを調整します
  2. 二重信号判断の論理を最適化
  3. ボランスなどなど多くの要素を含みます
  4. ストップ損失メカニズムを追加する

概要

この戦略は,価格の転換点を効果的に発見するために二重逆転判断を統合している.信号発生の可能性が減少するものの,信頼性は高く,中長期のトレンドを把握するのに適している. 戦略効果はパラメータ調整とマルチファクター最適化によってさらに強化することができる.


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

//@version=4
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 15/04/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 Performance indicator or a more familiar term, KPI (key performance indicator), 
// is an industry term that measures the performance. Generally used by organizations, 
// they determine whether the company is successful or not, and the degree of success. 
// It is used on a business’ different levels, to quantify the progress or regress of a 
// department, of an employee or even of a certain program or activity. For a manager 
// it’s extremely important to determine which KPIs are relevant for his activity, and 
// what is important almost always depends on which department he wants to measure the 
// performance for.  So the indicators set for the financial team will be different than 
// the ones for the marketing department and so on.
//
// Similar to the KPIs companies use to measure their performance on a monthly, quarterly 
// and yearly basis, the stock market makes use of a performance indicator as well, although 
// on the market, the performance index is calculated on a daily basis. The stock market 
// performance indicates the direction of the stock market as a whole, or of a specific stock 
// and gives traders an overall impression over the future security prices, helping them decide 
// the best move. A change in the indicator gives information about future trends a stock could 
// adopt, information about a sector or even on the whole economy. The financial sector is the 
// most relevant department of the economy and the indicators provide information on its overall 
// health, so when a stock price moves upwards, the indicators are a signal of good news. On the 
// other hand, if the price of a particular stock decreases, that is because bad news about its 
// performance are out and they generate negative signals to the market, causing the price to go 
// downwards. One could state that the movement of the security prices and consequently, the movement 
// of the indicators are an overall evaluation of a country’s economic trend.
//
// 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


PI(Period) =>
    pos = 0.0
    xKPI = (close - close[Period]) * 100 / close[Period]
    pos := iff(xKPI > 0, 1,
              iff(xKPI < 0, -1, nz(pos[1], 0))) 
    pos

strategy(title="Combo Backtest 123 Reversal & Perfomance index", 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, "---- Perfomance index ----")
Period = input(14, minval=1)
reverse = input(false, title="Trade reverse")
posReversal123 = Reversal123(Length, KSmoothing, DLength, Level)
posPI = PI(Period)
pos = iff(posReversal123 == 1 and posPI == 1 , 1,
	   iff(posReversal123 == -1 and posPI == -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 )

もっと