Dollar Américain / Yen japonais
Éducation
Mis à jour

Pine講座57 バックテスト|HullMA Strategyの解説

1057
HullMA は反応が良いのに線形はなめらか。

今まで勉強したことのないインジケーターですが、
ちょうどストラテジーをみつけたので解説してみようと思います。

次回はこのストラテジーに
トレンドフィルターを加えてみたいと思います。

※ 解説はコードの中で

※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)

=====
//version=2
strategy("HullMA Strategy の解説", overlay=true)

// ハル移動平均の計算期間
n=input(title="period",type=integer,defval=20)

// ハル移動平均の算出
n2ma=2*wma(close,round(n/2))
nma=wma(close,n)
diff=n2ma-nma
sqn=round(sqrt(n))
n2ma1=2*wma(close[1],round(n/2))
nma1=wma(close[1],n)
diff1=n2ma1-nma1
n1=wma(diff,sqn)
n2=wma(diff1,sqn)
c=n1>n2?green:red

// ハル移動平均の描画
ma=plot(n1,color=c)

// 売買(シンプルな途転戦略)
longCondition = n1>n2
if (longCondition)
strategy.entry("Long", strategy.long)

shortCondition = longCondition != true
if (shortCondition)
strategy.entry("Short", strategy.short)
=====
Note
次の講座
Pine講座58 バックテストにトレンドフィルターを追加する

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.