期間を区切って
バックテストを行うこともできます。
検証を比較する際に、
銘柄によって期間がまちまちだと
正確に行うことができません。
検証の各条件を揃えることで、
Pineスクリプトであってもしっかりと比較することができます。
※ 解説はコードの中で
※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)
=====
//@version=4
strategy( "STOP LIMIT の解説" ,overlay=true )
is_test_datetime = timestamp(2019,9,5,0,0) <= time and time <= timestamp(2019,9,6,0,0)
bgcolor( is_test_datetime ? color.gray : color.white )
entry1 = close < open
float a = na
float b = na
float c = na
if( entry1 and is_test_datetime and strategy.position_size==0 )
a := high
b := a + tr * 3
c := a - tr * 3
strategy.entry( "Entry1" ,strategy.long ,1 ,stop=a )
strategy.exit( "Exit1" ,"Entry1" ,stop=c ,limit=b )
=====
バックテストを行うこともできます。
検証を比較する際に、
銘柄によって期間がまちまちだと
正確に行うことができません。
検証の各条件を揃えることで、
Pineスクリプトであってもしっかりと比較することができます。
※ 解説はコードの中で
※ コピペする場合は以下の変更を行ってください
[](全角の角括弧)→(半角の角括弧)
(全角スペース)→(半角スペース)
=====
//@version=4
strategy( "STOP LIMIT の解説" ,overlay=true )
is_test_datetime = timestamp(2019,9,5,0,0) <= time and time <= timestamp(2019,9,6,0,0)
bgcolor( is_test_datetime ? color.gray : color.white )
entry1 = close < open
float a = na
float b = na
float c = na
if( entry1 and is_test_datetime and strategy.position_size==0 )
a := high
b := a + tr * 3
c := a - tr * 3
strategy.entry( "Entry1" ,strategy.long ,1 ,stop=a )
strategy.exit( "Exit1" ,"Entry1" ,stop=c ,limit=b )
=====
コメント:
次の講座