Hi, sorry for my poor English
I want to run a test with two or more data interval. For instance, let's take a look at the built-in signal MovAvgCross LE and SE. I want to run the test only in the week (7-13 december) and in the week(11-17 january).
inputs: Price( Close ), Length( 9 ), ConfirmBars( 1 ) ;
variables: var0( 0 ) ;
if date >1141206 and date < 1141214
and date >1150110 and date < 1150118 then begin
condition1 = Price > AverageFC( Price, Length ) ;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
if condition1 then
Buy ( "MACrossLE" ) next bar at market ;
end
the backtest didn't start and I don't know why. If I type just "if date >1141206 and date < 1141214" the backtest works. What do I have to do? Thank you in advance.
Working with more than one date interval [SOLVED]
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: Working with more than one date interval
YOu will need the brackets to separate the date logic, and to change one of the "and" to "OR".Hi, sorry for my poor English
I want to run a test with two or more data interval. For instance, let's take a look at the built-in signal MovAvgCross LE and SE. I want to run the test only in the week (7-13 december) and in the week(11-17 january).
inputs: Price( Close ), Length( 9 ), ConfirmBars( 1 ) ;
variables: var0( 0 ) ;
if date >1141206 and date < 1141214
and date >1150110 and date < 1150118 then begin
condition1 = Price > AverageFC( Price, Length ) ;
if condition1 then
var0 = var0 + 1
else
var0 = 0 ;
condition1 = CurrentBar > ConfirmBars and var0 = ConfirmBars ;
if condition1 then
Buy ( "MACrossLE" ) next bar at market ;
end
the backtest didn't start and I don't know why. If I type just "if date >1141206 and date < 1141214" the backtest works. What do I have to do? Thank you in advance.
Code: Select all
if (date >1141206 and date < 1141214)
OR (date >1150110 and date < 1150118)
then begin
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times