U.S. Dollar / Japanese Yen
Education
Updated

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

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

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

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

※ 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)
=====
Note
次の講座
Pine講座㊷ バックテスト|OutSide Bar Strategy の解説(つつみ足の途転戦略)

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.