yuya_takahashi_

Pine講座㊹ バックテスト|Pivot Reversal Strategy の解説

Edukasi
FX:USDJPY   Dollar A.S. / Yen Jepang
pivot high、pivot lowのブレイクによる途転売買ですね。
割と成績が良さそうです。

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

※ 解説はコードの中で

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

=====
//@version=4
strategy( "Pivot Reversal Strategy の解説", overlay=true )

//計算用の数値の設定
leftBars = input(4)
rightBars = input(2)

//pivot high と pivot low の算出
//検出すると値が入り、ないときはna
swh = pivothigh( leftBars, rightBars )
swl = pivotlow( leftBars, rightBars )

//swhの値の有無を確認
swh_cond = not na(swh)

//最新のswh価格を格納しておく
hprice = 0.0
hprice := swh_cond ? swh : hprice

//Long Entry の判断
//pivot high が検出されたら発火
le = false
le := swh_cond ? true : (le and high > hprice ? false : le)

if (le)
//pivot high の1ティック上で逆指値
strategy.entry("PivRevLE", strategy.long, comment="PivRevLE", stop=hprice + syminfo.mintick)

//以下、買いエントリーの逆
swl_cond = not na(swl)

lprice = 0.0
lprice := swl_cond ? swl : lprice


se = false
se := swl_cond ? true : (se and low < lprice ? false : se)

if (se)
strategy.entry("PivRevSE", strategy.short, comment="PivRevSE", stop=lprice - syminfo.mintick)

//確認用で描画
plot( swh ,offset=-2 ,style=plot.style_circles ,linewidth=3 ,color=color.red )
plot( swl ,offset=-2 ,style=plot.style_circles ,linewidth=3 ,color=color.red )
plot( hprice )
plot( lprice )

//plot(strategy.equity, title="equity", color=color.red, linewidth=2, style=plot.style_areabr)
=====
Komentar:
次の講座

小次郎講師公式インジケーターのお申込
bit.ly/2vdSV4Q

小次郎講師のLINE@
bit.ly/2VZQFu3

小次郎講師のチャート情報局
bit.ly/2GvLAEp
Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.