慣性指標の取引戦略

作者: リン・ハーンチャオチャン,日付: 2023-12-26 15:42:33
タグ:

img

概要

慣性指標取引戦略は,相対変動指数 (RVI) をベースとしたトレンドフォローするアルゴリズム的な取引戦略である.証券のRVIを計算することによって市場,株式または通貨ペアの勢いと傾向を測定する.長期的なトレンドの方向性を決定し,取引信号を生成することができる.

戦略の論理

この戦略の主要な指標は,慣性の指標値は0から100までの範囲で,50以上の値が正気力を表し,50以下の値が負気力を表す.慣性の値が50以上である限り,上昇傾向を示します.そしてその逆.

計算方法は次のとおりです.

  1. 決済価格の標準偏差 StdDev を計算する
  2. 今日と昨日の閉店価格の比較に基づいて,上昇波動 u と下落波動 d を計算する.
  3. インディケーター nU と nD を取得するためにスムーズ u と d
  4. 相対変動指数 nRVI = 100 * nU / (nU + nD) を計算する
  5. 最終慣性値 nRes を得るために指数的に平らな nRVI

nResが50を超えると 購入信号が発信され 50を下回ると 販売信号が発信されます

利点分析

この戦略の最大の利点は,トレンドを追跡し,市場統合中に頻繁な開拓を回避できる.さらに,単純な指標計算には計算資源が少なく,アルゴリズム取引に適している.

リスク分析

最大のリスクは,指標自体に遅れがあり,ターニングポイントを100%捉えることができないこと.これはより良い開拓機会を逃す結果になる可能性があります. さらに,指標のパラメータ設定は戦略パフォーマンスにも影響し,最適なパラメータを見つけるために多くのバックテストが必要です.

リスクを減らすために,他の技術的または基本的指標と組み合わせて,より多くの要因を使用して開口を決定することを検討します.同時に,各取引のポジションサイズを制御します.

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

戦略は以下の側面で最適化できます.

  1. パラメータ最適化.最適なパラメータ組み合わせを見つけるためにサイクルパラメータとスムージングパラメータの設定を変更します.

  2. 他の指標と組み合わせる.より情報に基づいた意思決定のために移動平均値,RSI,その他の指標を使用する.

  3. ダイナミックなポジションサイズ 市場の状況と指標値に基づいて,それぞれの取引のポジションサイズをダイナミックに調整します

  4. 自動ストップ・ロスト ストップ・ロストポジションを設定して トレード毎の最大損失を効果的に制御します

結論

慣性指標取引戦略は,比較的シンプルで信頼性の高いトレンドフォロー戦略である.慣性指標に基づいて価格トレンド方向を決定し,トレードポジションを確立するトレンドをフォローする.パラメータ最適化,指標組み合わせを通じて戦略パフォーマンスをさらに向上させ,定量取引に適したアルゴリズム戦略である.


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

//@version=2
////////////////////////////////////////////////////////////
//  Copyright by HPotter v1.0 23/05/2017
// The inertia indicator measures the market, stock or currency pair momentum and 
// trend by measuring the security smoothed RVI (Relative Volatility Index). 
// The RVI is a technical indicator that estimates the general direction of the 
// volatility of an asset.
// The inertia indicator returns a value that is comprised between 0 and 100. 
// Positive inertia occurs when the indicator value is higher than 50. As long as 
// the inertia value is above 50, the long-term trend of the security is up. The inertia 
// is negative when its value is lower than 50, in this case the long-term trend is 
// down and should stay down if the inertia stays below 50.
//
// 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="Inertia Indicator", shorttitle="Inertia")
Period = input(10, minval=1)
Smooth = input(14, minval=1)
reverse = input(false, title="Trade reverse")
hline(50, color=green, linestyle=line)
xPrice = close
StdDev = stdev(xPrice, Period)
d = iff(close > close[1], 0, StdDev)
u = iff(close > close[1], StdDev, 0)
nU = (13 * nz(nU[1],0) + u) / 14
nD = (13 * nz(nD[1],0) + d) / 14
nRVI = 100 * nU / (nU + nD)
nRes = ema(nRVI, Smooth)
pos = iff(nRes > 50, 1,
	     iff(nRes < 50, -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=red, title="Inertia")


もっと