Can one use timeframeset function for custom made function or array?

function invf( x1, x2)
{
  series=Close-Close[10];
  x11= 0.1*(RSIa(series,x1) - 50);
  x22= WMA(x11,x2);

  invfisher = 100*(exp(2*x22) - 1)/(exp(2*x22) + 1);
  Signall=MA(invfisher,2);
  babu=IIf(invfisher>Signall,1,0); // do something with arguments

  return babu;
}


TimeFrameSet(inWeekly);
invfw=invf(20,21);
TimeFrameRestore();

Plot(invf(20,21),"InvFunct",colorAqua);
Plot(TimeFrameExpand(invfw,inWeekly),"weeklyinv",colorDarkYellow);

I don’t know from where you got that code but it is wrong. invf function is wrong. Close[ 10 ] is NOT close 10 bars ago but Close at 10th bar (scalar value). Should use Ref function instead http://www.amibroker.com/f?ref