TradingView
yuya_takahashi_
2019年8月15日午前3時25分

Pine講座㊶ バックテスト|Stochastics Slow Strategy の解説(ストキャスの途転戦略) 教育

U.S. Dollar/Japanese YenFXCM

詳細

逆張りの途転戦略ほど
怖いものはありません。

この戦略は、
ガッツリトレンドが出たときに
もれなく大負けしてしまいますね。

損切りを設定する必要があります。

※ TradingView内蔵のストラテジーを
  上から順番に解説しています

※ 解説はコードの中で

=====
//@version=4
strategy("Stochastic Slow Strategy の解説", overlay=false)

//ストキャスの設定諸々
length = input(14, minval=1)
OverBought = input(80)
OverSold = input(20)
smoothK = 3
smoothD = 3

//ストキャスの算出
k = sma(stoch(close, high, low, length), smoothK)
d = sma(k, smoothD)

//ストキャスの値があることを確認
if (not na(k) and not na(d))
//%Kが20よりも下で%Dを上抜けしたとき
if (crossover(k,d) and k < OverSold)
//成行買い(売りがある場合は途転買い)
strategy.entry("StochLE", strategy.long, comment="StochLE")
//%Kが80よりも上で%Dを下抜けしたとき
if (crossunder(k,d) and k > OverBought)
//成行売り(買いがある場合は途転売り)
strategy.entry("StochSE", strategy.short, comment="StochSE")

//確認用で描画
plot(k)
plot(d,color=color.red)
hline(OverSold)
hline(OverBought)
=====

コメント

次の講座
詳細