I HAVE THE FOLLOWING PIECE OF CODE BUT WHEN I TRY TO RUN IT, THERE IS SYNTAX ERROR AT THIS LINE
"vars Close = series(priceClose()); "
KINDLY HELP ME PUT THIS IN A FUNCTIONAL WAY, .....AND MAYBE ADD ANY OTHER USEFUL INFORMATION I MAY BE REQUIRED TO ADD TO THE SCRIPT. THANK YOU wink wink


//TMF to adjust the stop in a special way for Long
int TrailingStopLong()
{
//adjust the stop only when the trade is in profit
if(TradeProfit > 0)
//place the stop at te lowest bottom of the previous 3 candles
TradeStopLimit = max(TradeStopLimit,LL(3));
//plot a line to make the stop limit visible
plot("stop", TradeStopLimit, MINV, BLACK);
//RETURN 0 FOR CHECKING THE LIMITS
return 0;
}

int TrailingStopShort()
{
//adjust the stop only when the trade is in profit
if(TradeProfit > 0)
//place the stop at the highest top of the previous 3 candles
TradeStopLimit = max(TradeStopLimit,HH(3));
//plot a line to make the stop limit visible
plot("stop", TradeStopLimit, MINV, BLACK);
//RETURN 0 FOR CHECKING THE LIMITS
return 0;
}
//Trade when a fast SMA crosses over a slow SMA

function run()
{


StartDate = 2005;
BarPeriod = 60;
Lots = 30;
MaxLong = 1;
MaxShort = 1;
//Stop = 2 * ATR(14);
//Trail = 2 * ATR(14);
//EntryTime =
Entry = -5*PIP;
Algo = "SMA 15,5"

vars Close = series(priceClose());
vars SMAFast = series(SMA(Close, 5));
vars SMASlow = series(SMA(Close, 15));

if(crossOver(SMAFast, SMASlow))
enterLong(TrailingStopLong);
else if(crossUnder(SMAFast, SMASlow))
exitLong(TrailingStopShort);
//exit long and go short if 5 SMA crosses under 15 SMA
if(crossUnder(SMAFast, SMASlow))
enterShort();
else if(crossOver(SMAFast, SMASlow))
exitShort();


for(open_trades)
if(TradeIsOpen && !TradeIsPool && TradeProfit > 0) {
TradeTrailLock = 0.80; // 80% profit (minus trade costs)
if(TradeIsShort)
TradeTrailLimit = max(TradeTrailLimit,TradePriceClose);
else
TradeTrailLimit = min(TradeTrailLimit,TradePriceClose);
}


//plot the graph

set(PLOTNOW);
PlotWidth = 1200;
PlotHeight1 = 400;
}