liftoff, you're using Slow and Fast as variable names for 3 different things:
1. int Fast for the starting point of your loop
2. as the control variable for the for loop
3. as the name of a series that contains doubles

Looking through the code, it seems like you expect to get 30 lines of output. When I run your code, I get 10 with odd values.

The sprintf statement doesn't look right (could be because I don't know what %i is as a format. I can't find it in the manual).

Just as a shell, without the trading portion, try this:
Code:
function run()
{
  StartDate = 2003;
  EndDate   = 2008;
  BarPeriod = 30;
  LookBack  = 60;          // changed from 30 Maximum period is 60
  asset("GBP/USD");

  int  MinSlow = 20;       // renamed
  int  MinFast = 1;        // renamed
  int  MaxSlow = 60;
  int  MaxFast = 10;
  int  ThisFast, ThisSlow; // while loop control variables

  // 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;

      // insert trade logic here

      if ( is(EXITRUN) )
      {
        sprintf(line,
                "\n%6d, %6d, %6.2f, %6.2f",
                ThisSlow, ThisFast, WinTotal, LossTotal); // reformatted the output string and changed output variables to curreent loop control variable values
        file_append("NetProfit.csv", line);
      }

      ThisFast = ThisFast + MinFast;                      // increment while control variable
    } // while ( ThisFast <= MaxFast )

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

} /* run */



My changes are indicated in comments.
The output is:

Code:
20,      1,   0.00,   0.00
    20,      2,   0.00,   0.00
    20,      3,   0.00,   0.00
    20,      4,   0.00,   0.00
    20,      5,   0.00,   0.00
    20,      6,   0.00,   0.00
    20,      7,   0.00,   0.00
    20,      8,   0.00,   0.00
    20,      9,   0.00,   0.00
    20,     10,   0.00,   0.00
    40,      1,   0.00,   0.00
    40,      2,   0.00,   0.00
    40,      3,   0.00,   0.00
    40,      4,   0.00,   0.00
    40,      5,   0.00,   0.00
    40,      6,   0.00,   0.00
    40,      7,   0.00,   0.00
    40,      8,   0.00,   0.00
    40,      9,   0.00,   0.00
    40,     10,   0.00,   0.00
    60,      1,   0.00,   0.00
    60,      2,   0.00,   0.00
    60,      3,   0.00,   0.00
    60,      4,   0.00,   0.00
    60,      5,   0.00,   0.00
    60,      6,   0.00,   0.00
    60,      7,   0.00,   0.00
    60,      8,   0.00,   0.00
    60,      9,   0.00,   0.00
    60,     10,   0.00,   0.00



which looks more like what you're expecting.

hth.

(Pork types faster than I do! laugh )

Last edited by Jeff_Raven; 01/08/14 15:40. Reason: ETA