Hi Petra,

aaaarghh! You got me there. Zorro makes things so simple that I ended up thinking it makes things even simpler than it actually does! You are right, both entry levels have to be static or they will reset to zero at the next bar. Sell and buy stops at zero are, I gather, interpreted as market entries so that explains why there were so many additional trades (They are now down to 1872 - in line with the book.). I did check a segment of the results curve but (Murphy's Law) got one where the stop entries were filled at signal-1, otherwise the problem would have been apparent.

Anyway, in case this helps anyone, here is the new version of the script with equity curve. Note the debug statement - this is pretty much indispensable to check for issues and I should have put it there from the start.

Code:
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;//optimize(30, 10, 60, 5);
	var shortPeriod = 10;//optimize(10, 1, min(longPeriod, 20), 1);	
	vars Price = series(priceClose());
	vars slowMA = series(SMA(Price, longPeriod));
	vars fastMA = series(SMA(Price, shortPeriod));	
	static bool debug = true;	
	static double buyStopLevel = 0;
	static double sellStopLevel = 0;	
	bool goLong = false;
	bool goShort = false;
	LookBack = longPeriod;	
	
	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);		
	}
	
	if( (debug) && (is(LOOKBACK) == false) )
	{
		debug = msg("Lookback = %i, Low = %.5f, High = %.5f, BuyStopLevel = %.5f, SellStopLevel = %.5f, FastMA = %.5f, SlowMA = %.5f, GoShort = %i, GoLong = %i, CrossOver = %i, CrossUnder = %i, LongPos = %i, ShortPos = %i ", 
			is(LOOKBACK), priceLow(0), priceHigh(0), buyStopLevel, sellStopLevel, fastMA[0],slowMA[0], goShort, goLong, crossOver(fastMA, slowMA), crossUnder(fastMA, slowMA), NumOpenLong, NumOpenShort);
	}	
}





What is interesting is that the equity curve now does resemble the book curve ("features" match) BUT looks like a detrended version - the book curve shows an attractive upward drift that is not present in mine. Does anyone have any idea where that might come from? I guess it might be the result of reinvestment but the book script simply uses (EasyLanguage) "Buy" and "Sell" without any position size indication so I assume it is constant...

Anyway, thank you very much for this suggestion Petra.