yuya_takahashi_

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

Đào tạo
yuya_takahashi_ Cập nhật   
FX:USDJPY   Đô la Mỹ / Yên Nhật
上位のストラテジーは古いものが多いので、
成行注文のものが多いですね。

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 )
=====
Bình luận:
次の講座

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

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

小次郎講師のチャート情報局
bit.ly/2GvLAEp
Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.