yuya_takahashi_

Pine講座52 バックテストで指値注文

教育
yuya_takahashi_ アップデート済   
FX:USDJPY   米ドル/円
上位のストラテジーは古いものが多いので、
成行注文のものが多いですね。

version3、version4では
指値注文も使うことができます。

手法によっていは、
すこしだけ有利になるかもしれません。

※ 解説はコードの中で

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

=====
//@version=4
strategy( "STOP LIMIT の解説" ,overlay=true )

entry1 = time[1] < timestamp(2019,9,4,6,00) and time >= timestamp(2019,9,4,6,00)
exit1 = time[1] < timestamp(2019,9,4,9,00) and time >= timestamp(2019,9,4,9,00)
entry2 = time[1] < timestamp(2019,9,4,12,00) and time >= timestamp(2019,9,4,12,00)
diff = time - time[1]

if( entry1 )
 line.new( bar_index ,high+tr*5 ,bar_index ,low-tr*5 ,color=color.red )
 strategy.entry( "Entry1" ,strategy.long ,1 ,when=entry1 )

if( exit1 )
 line.new( bar_index ,high+tr*2 ,bar_index ,low-tr*2 ,color=color.red )
 strategy.close( "Entry1" ,exit1 )

if( entry2 )
 line.new( bar_index ,high+tr*5 ,bar_index ,low-tr*5 ,color=color.red )
 strategy.entry( "Entry2" ,strategy.long ,1 )
 line.new( time ,close-tr*3 ,time+diff*30 ,close-tr*3 ,xloc=xloc.bar_time ,color=color.red )
 line.new( time ,close+tr*3 ,time+diff*30 ,close+tr*3 ,xloc=xloc.bar_time ,color=color.red )
 strategy.exit( "Exit2" ,"Entry2" ,stop=close-tr*3 ,limit=close+tr*3 )
=====
コメント:
次の講座

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

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

小次郎講師のチャート情報局
bit.ly/2GvLAEp
免責事項

これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。