yuya_takahashi_

Pine講座㊺ バックテスト|Consecutive Up/Down Strategy の解説

Education
FX:USDJPY   U.S. Dollar / Japanese Yen
連続陽線・連続陰線で途転売買していくストラテジーです。

これで、内蔵のストラテジーはすべて完了です!

次回以降は、サードパーティのものを確認して、
Pine講座もそろそろお終いですね。

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

※ 解説はコードの中で

※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)

=====
//@version=4
strategy( "Consecutive Up/Down Strategy の解説", overlay=false )

//連続の数を設定
consecutiveBarsUp = input(3)
consecutiveBarsDown = input(3)

price = close

//連続上昇をカウント
ups = 0.0
ups := price > price[1] ? nz(ups[1]) + 1 : 0

//連続下降をカウント
dns = 0.0
dns := price < price[1] ? nz(dns[1]) + 1 : 0

//連続上昇が設定値以上のとき
if (ups >= consecutiveBarsUp)
//買いエントリー
strategy.entry("ConsUpLE", strategy.long, comment="ConsUpLE")

//連続下降が設定値以上のとき
if (dns >= consecutiveBarsDown)
//売りエントリー
strategy.entry("ConsDnSE", strategy.short, comment="ConsDnSE")

plot( ups ,color=color.red )
plot( dns ,color=color.blue )
=====
Comment:
次の講座
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.