I tried running this code and I ended up with the too many trades error. I believe the loop was happening every bar, but we are trying to achieve a loop after every complete cycle. So after every bar, the run function will run a number of times per the loop we created. Its either that or something along those lines. Here is the code I run with.
Code:
function run()
{
	
	StartDate = 2003;
	EndDate = 2008;
	BarPeriod = 30;
	LookBack = 60; // Lookback period changed from default 30 to 60 to cater for largest slow period
	asset("GBP/USD");
		
	 int  MinSlow = 20;       // Minimum Slow Period
  	 int  MinFast = 1;        // Minumum Fast Period
  	 int  MaxSlow = 60;		  // Maximum Slow Period
  	 int  MaxFast = 10;		  // Maximum Fast Period
  	 int  ThisFast, ThisSlow; // while loop control variables
  	 int  SlowInc = 1;		  // Slow Period Incremental Value
  	 int  FastInc = 1;		  // Fast Incremental Value

  // no trade costs...
  	Spread    = 0;
  	Slippage  = 0;
  	RollLong  = RollShort = 0;
  	char line[100];	
	
	ThisSlow  = MinSlow;                                    // initialize while control variable

 	 while ( ThisSlow <= MaxSlow )                           // changed for to while
  	{
    ThisFast = MinFast;                                   // initialize while control variable
 
    while ( ThisFast <= MaxFast )                         // changed for to while 
    {
      vars       Price = series(priceClose() ),
                 Fast  = series(SMA(Price, ThisFast) ),   // replace SMA parameter with current loop control variable value
                 Slow  = series(SMA(Price, ThisSlow) );   // replace SMA parameter with current loop control variable value

      static var BuyLimit, SellLimit, BuyStop, SellStop;
      
					
				if(crossOver(Fast,Slow)) {
					BuyStop = priceHigh() + 1*PIP;
					BuyLimit = priceHigh() + 5*PIP;
				}
				if(crossUnder(Fast,Slow)) {
					SellStop = priceLow() - 1*PIP;
					SellLimit = priceLow() - 5*PIP;
				}
					
				if(!NumOpenLong && Fast[0] > Slow[0] && Price[0] < BuyLimit)
					enterLong(1,BuyStop);
				if(!NumOpenShort && Fast[0] < Slow[0] && Price[0] > SellLimit)
					enterShort(1,SellStop);
			
			if ( is(EXITRUN) )
      {
        sprintf(line,
                "\n%6d, %6d, %6.2f, %6.2f",
                ThisSlow, ThisFast, WinTotal, LossTotal); // line sent to csv file
        file_append("NetProfit.csv", line);
      }	
      ThisFast = ThisFast + FastInc;                      // increment while control variable
   } // while ( ThisFast <= MaxFast )

    ThisSlow = ThisSlow  + SlowInc;                       // increment while control variable
  } // while ( ThisSlow <= MaxSlow )		
}


I think that is what jcl meant