yuya_takahashi_

Pine講座㊱ バックテスト|RSI Strategyの解説(RSIによる途転売買)

Education
FX:USDJPY   U.S. Dollar / Japanese Yen
今回は「RSI Strategy」のコードを解説します!

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

※ 解説はコードの中で

このストラテジーは、エントリーしたあと、
じわじわ逆方向に動くと大変です。

あまり良いスキームではありませんね。
(ハマる値動きはあると思います)

=====
//@version=4
strategy( "RSI Strategy の解説" )

//設定の項目と初期値の指定
//RSIを計算する期間
length = input( 14 )

//買いエントリーの基準となるライン
overSold = input( 30 )

//売りエントリーの基準となるライン
overBought = input( 70 )

//計算に使う価格
price = close

//RSIの計算
vrsi = rsi(price, length)

//RSIの計算値がある
if (not na(vrsi))
//基準のライン(初期値:30)を上抜けたら
if (crossover(vrsi, overSold))
//買いエントリー
strategy.entry("RsiLE", strategy.long, comment="RsiLE")
//基準のライン(初期値:70)を下抜けたら
if (crossunder(vrsi, overBought))
//売りエントリー
strategy.entry("RsiSE", strategy.short, comment="RsiSE")

//確認用で描画
plot( vrsi )
hline( overSold )
hline( overBought )
=====
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.