function run()
{
StartDate = 20021021;
EndDate = 20080704;
BarPeriod = 30;
LookBack = 30;
set(TICKS|PLOTNOW);
PlotWidth = 800;
asset("GBP/USD");
// no commissions...
Spread = 0;
Slippage = 0;
RollLong = RollShort = 0;
vars Price = series(priceClose()),
Fast = series(SMA(Price,3)),
Slow = series(SMA(Price,30));
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);
}