Hi,

I write this MTF script.
It uses 15 min bar on entry and 4h on exits.
By seeing a plot, 4h exit works correctly but entry is not what I expect, although both plots are correct.

I think I am wrong at using MTF and I am not sure that where is scope for TimeFrame so plese correct it.

Code:
function run(){
	
set(PLOTPRICE+PLOTNOW);
BarPeriod = 15;
LookBack = 5000;
StartDate = 20121024;
NumDays = 5;
set(TICKS);
  
TimeFrame = 1;
vars Close = series(priceClose());
vars tmp1 = series(SMA(Close,21));
	
TimeFrame = 16;
vars Close = series(priceClose());
vars tmp16 = series(SMA(Close,21));

        
if(priceClose(0) < tmp1[0])
enterShort();


if(priceClose(0) > tmp16[0]  )
exitShort();
        
plot("SMA15min", tmp1[0], 0, RED);
plot("SMA4h", tmp16[0], 0, RED);

}



Last edited by SFF; 03/11/13 10:48.