Hello everyone,
and thanks jcl and all involved for your very interesting system.
To find out a bit more about the programming side of things, I have tried to replicate the Luxor system described in the book by Jaekle and Tomasini and mentioned in the literature list on this forum. It seems very simple and yet I am unable to replicate equity curves that look even remotely as good as the book's basic case without exit, time filter or transaction costs. Here is my script:
function run()
{
StartDate = 20021021;
EndDate = 20080704;
set(LOGFILE|PLOTNOW); // log all trades
//Try and replicate best given graph
Slippage = 0;
Spread = 0;
BarPeriod = 30;
var longPeriod = 30;
var shortPeriod = 10;
vars Price = series(priceClose());
vars slowMA = series(SMA(Price, longPeriod));
vars fastMA = series(SMA(Price, shortPeriod));
var buyStopLevel = 0;
var sellStopLevel = 0;
bool goLong = false;
bool goShort = false;
if (fastMA[0] > slowMA[0])
{
goLong = true;
}
if (fastMA[0] < slowMA[0])
{
goShort = true;
}
if(crossOver(fastMA, slowMA) == true)
{
//Just reset stop level of trade suggested by MA distance sign
buyStopLevel = priceHigh(0) + PIP;
}
else if(crossUnder(fastMA, slowMA) == true)
{
sellStopLevel = priceLow(0) - PIP;
}
if ((goLong == true) && (NumOpenLong == 0))
{
enterLong(0, buyStopLevel);
}
else if ((goShort == true) && (NumOpenShort == 0))
{
enterShort(0, sellStopLevel);
}
plot("FastMA",fastMA[0],0,RED);
plot("SlowMA",slowMA[0],0,GREEN);
PlotWidth = 800;
PlotHeight1 = 320;
}
So this is a basic MA crossover system except that entries use a stop order for filtering. The book's results are given in the curve on page 44 and the table on page 45. The results I have obtained are miles away! This seems odd for such a simple strategy and so I wonder a) whether there is some stupid coding error in the above or b) if not, whether differences of the order of magnitude seen (e.g. their # of trades - 1913, mine - 2675) are to be expected between different data feeds at this TF.
I am aware the book also prints '3' for the short MA period but I believe that is a typo - when I use 3 I get better performance but, plausibly, a lot more trades still (3691).
Thanks for any input!