Hello.

Reviewing your question i've noticed you probably really wanted to do this:

Code:
function run()
{
    StartDate = 20150601;
    EndDate = 20151201;
    BarPeriod = 24*60;
    asset("EUR/USD");
    
    vars price = series(priceClose());
    vars ema = series(EMA(price,10));
    vars crosses = series(0);
    
    int i;
    var period = 5;
    var crossed = 0;

	for(i=0; i<period; i++)
		if(crossOver(price+i, ema+i) || crossUnder(price+i,ema+i))
                     crosses[0] = ++crossed

    PlotWidth = 1024;
    PlotHeight1 = 400;
    plot("EMA",ema,MAIN,PURPLE);
    plot("Crossed",crossed,NEW,RED);
    plot("Crosses",crosses,NEW,BLUE);
}



This is a rolling counting of crosses with a moving average. The "crosses" series is not necessary, but in case you want to further evaluate the results, this way you'll have a mechanism to do it, instead of just incrementing a variable.

Take a look to the series instruction, you'll learn a lot:
http://www.zorro-trader.com/manual/en/series.htm

If this is not what you wanted, then i hope it helps you with further developments.

Bye.