//ストキャスの算出 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")
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.