دولار أمريكي / ين ياباني
تعليم
تم تحديثه

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

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.