yuya_takahashi_

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

Education
FX:USDJPY   U.S. Dollar / Japanese Yen
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,round(n/2))
nma1=wma(close,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)
=====
Comment:
次の講座

小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q

小次郎講師のLINE@
bit.ly/2VZQFu3

小次郎講師のチャート情報局
bit.ly/2GvLAEp
Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.