Dollar Américain / Yen japonais
Éducation
Mis à jour

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

2248
上位のストラテジーは古いものが多いので、
成行注文のものが多いですね。

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 )
=====
Note
次の講座
Pine講座53 バックテストでエントリーも指値注文

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.