I am trying a multitimeframe strategy and it doesn't work. Anyone can tell me where is the mistake in the following script?

function trenta()
{
TimeFrame = 1;

vars A1 = series(priceHigh(2));
vars A2 = series(priceHigh(1));
vars A3 = series(price(0));
var percentage = 0.001;
var VlrH;

VlrH = A1[0] * percentage;



if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort();

vars B1 = series(priceLow(2));
vars B2 = series(priceLow(1));
vars B3 = series(price(0));
var percentage = 0.001;
var VlrL;

VlrL = B1[0] * percentage;



if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+VlrL) enterShort();


Stop = optimize(30,20,200)*PIP;
TakeProfit = optimize(500,150,700)*PIP;
ExitTime = 25;


}

function doscents()
{
TimeFrame = 8;

vars A1 = series(priceHigh(2));
vars A2 = series(priceHigh(1));
vars A3 = series(price(0));
var percentage = 0.001;
var VlrH;

VlrH = A1[0] * percentage;



if (A1[0] < A2[0] and A3[0] < A1[0]-VlrH) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+VlrH) enterShort();

vars B1 = series(priceLow(2));
vars B2 = series(priceLow(1));
vars B3 = series(price(0));
var percentage = 0.001;
var VlrL;

VlrL = B1[0] * percentage;



if (B1[0] < B2[0] and B3[0] < B1[0]-VlrL) enterLong();
if (A1[0] > A2[0] and A3[0] > A1[0]+VlrL) enterShort();


Stop = optimize(30,20,200)*PIP;
TakeProfit = optimize(500,150,700)*PIP;
ExitTime = 10;

}

function run()
{

set (PARAMETERS);
BarPeriod = 30;
StartDate = 2011;
EndDate = 2013;
function trenta();
function doscents();
NumWFOCycles = 3;

}

The two functions used, individually they run fine but when trying to run them together, don't work.