Hi jcl,

Been following your thread on babypips and learning your lessons on programming c for backtesting. Thanks for the great work your doing I appreciate it.

I have one question in regards to your code you posted above:

Quote:


function run()
{
BarPeriod = 240;
StartDate = 2006;
NumYears = 7;
NumWFOCycles = 12;
set(PARAMETERS|TESTNOW);

var *Price = series(price());
var *LP5 = series(LowPass(Price,5));
var *LP10 = series(LowPass(Price,optimize(10,6,20)));
var *RSI10 = series(RSI(Price,10));
Stop = optimize(5,1,10)*ATR(30);

static int crossed = 0;
if(crossOver(LP5,LP10))
crossed = Delay;
else if(crossUnder(LP5,LP10))
crossed = -Delay;

if(crossed > 0 && crossOver(RSI10,50)) {
enterLong();
crossed = 0;
} else if(crossed < 0 && crossUnder(RSI10,50)) {
enterShort();
crossed = 0;
} else
crossed -= sign(crossed);
}



The 'Delay' variable is not defined and wont work in Zorro, I understand that it needs to be identified just having a little trouble working out what needs to be done here to rectify your code to acheive that optimised result you posted.

Regards
TankWolf

Edit: Looking over this again and reading what the crossOver and crossUnder functions do is it correct that delay shouldnt actually be there and it should be 1 or -1 because the next part of the code looks to go long if crossed is > 0 since the crossOver function looks if data1 crosses over data2 so then if it does it should assign crossed = 1?

Last edited by TankWolf; 09/24/12 13:25.