U.S. Dollar / Japanese Yen
Education
Updated

Pine講座54 期間を区切ってバックテストを行う

2840
期間を区切って
バックテストを行うこともできます。

検証を比較する際に、
銘柄によって期間がまちまちだと
正確に行うことができません。

検証の各条件を揃えることで、
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 )
=====
Note
次の講座
Pine講座55 バックテスト|Strategy Code Example - Risk Management の解説

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.