標準的なフラクショナル価格ブレイクアウト戦略


作成日: 2023-12-07 15:17:43 最終変更日: 2023-12-07 15:17:43
コピー: 0 クリック数: 1088
1
フォロー
1621
フォロワー

標準的なフラクショナル価格ブレイクアウト戦略

概要

標準分数価格突破戦略 (Z-Score Price Breakout Strategy) は,価格の標準分数指標を使用して,現在の価格が異常な状態にあるかどうかを判断し,取引シグナルを生成する.価格の標準分が特定の値より高くまたは低く,価格が異常な状態に入っていることを示し,このとき,多額または空白の操作を行うことができます.

戦略原則

この戦略の核心指標は,価格のスタンダードスコア (Z-Score) で,計算式は以下の通りである.

Z_score = (C - SMA(n)) / StdDev(C,n)

Cは,閉店価格,SMA (n) は,n周期の単純移動平均線,StdDev (C,n) は,n周期の閉店価格の標準差である.

標準分は,現在の価格と平均価格の偏差の程度を反映する.価格標準分が,ある正の値 (例えば+2) よりも大きいときは,現在の価格が平均価格から2標準差が高く,比較的高いレベルにあることを示し,ある負の値 (例えば-2) よりも小さいときは,現在の価格が平均価格から2標準差が低く,比較的低いレベルにあることを示している.

この戦略は,まず価格の標準分を計算し,その後,正負の値 (例えば0と0) を設定し,標準分が正の値より高いときは買入シグナルを発生させ,負の値より低い場合は売り出します.

優位分析

  • 価格基準のスコアを用いて価格異常を判断する,一般的な効果的な量化方法
  • 利回りと空調の両方での取引が容易に可能
  • パラメータ設定の柔軟性,周期,値など調整可能
  • 他の指標と組み合わせて取引システムを作ることができる

リスク分析

  • スタンダードスコア戦略は粗放で,偽信号を生成しやすい.
  • 周期や値などの適切なパラメータを設定する必要があります
  • リスクのコントロールを考える

最適化の方向

  • 周期を最適化して,最適な周期を探します.
  • ポジティブ・ネガティブ・値の最適化と偽信号の低減
  • フィルタリング条件を追加し,他の指標と組み合わせる
  • ストップ・ロスの策略を増やす

要約する

標準分数価格突破戦略は,現在の価格が異常な状態にあるかどうかを判断し,価格標準分数の正負に基づいて取引する.この戦略は簡単で,両方向に取引できるが,一定のリスクもある.パラメータ最適化やストップ・ロスのような手段によって,この戦略を強化し,他の指標の組み合わせと完全な量化取引システムを形成することができる.

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

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 18/01/2017
// The author of this indicator is Veronique Valcu. The z-score (z) for a data 
// item x measures the distance (in standard deviations StdDev) and direction 
// of the item from its mean (U):
//     z = (x-StdDev) / U
// A value of zero indicates that the data item x is equal to the mean U, while 
// positive or negative values show that the data item is above (x>U) or below 
// (x Values of +2 and -2 show that the data item is two standard deviations 
// above or below the chosen mean, respectively, and over 95.5% of all data 
// items are contained within these two horizontal references (see Figure 1).
// We substitute x with the closing price C, the mean U with simple moving 
// average (SMA) of n periods (n), and StdDev with the standard deviation of 
// closing prices for n periods, the above formula becomes:
//     Z_score = (C - SMA(n)) / StdDev(C,n)
// The z-score indicator is not new, but its use can be seen as a supplement to 
// Bollinger bands. It offers a simple way to assess the position of the price 
// vis-a-vis its resistance and support levels expressed by the Bollinger Bands. 
// In addition, crossings of z-score averages may signal the start or the end of 
// a tradable trend. Traders may take a step further and look for stronger signals 
// by identifying common crossing points of z-score, its average, and average of average. 
//
// You can change long to short in the Input Settings
// Please, use it only for learning or paper trading. Do not for real trading.
////////////////////////////////////////////////////////////
strategy(title="Z-Score Strategy", shorttitle="Z-Score Strategy")
Period = input(20, minval=1)
Trigger = input(0)
reverse = input(false, title="Trade reverse")
hline(Trigger, color=purple, linestyle=line)
xStdDev = stdev(close, Period)
xMA = sma(close, Period)
nRes = (close - xMA) / xStdDev
pos = iff(nRes > Trigger, 1,
	   iff(nRes < Trigger, -1, nz(pos[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)	   	    
barcolor(possig == -1 ? red: possig == 1 ? green : blue )
plot(nRes, color=blue, title="Z-Score")