Timframe in Afl Function

Hello Guys, I am using following code for intraday scanning , it works fine. But when I want to use it for Daily , I am unable to code this please help.

function MyMTFfunc( timeframe, expandmode )
{
    TimeFrameSet( timeframe );
   
    a = StochK( periods = 14, ksmooth = 3 );
    b = StochD( periods = 14, Ksmooth = 3, Dsmooth = 3 ) ;
    
    D1 = a<1000;
    TimeFrameRestore();

    VarSet( "K" + timeframe, TimeFrameExpand( a, timeframe, expandmode ) );
    VarSet( "D" + timeframe, TimeFrameExpand( b, timeframe, expandmode ) );

return TimeFrameExpand( D1, timeframe, expandmode );
}

expandmode = expandLast;
TF1 = MyMTFfunc( inDaily, expandmode );
TF2 = MyMTFfunc( 3*inDaily, expandmode );
TF3 = MyMTFfunc( 6*inDaily, expandmode );

k1 = K300; //300 for 5min
k2 = K900; //900 for 15min
k3 = K1800;//1800 for 30min
d1 = D300; 
d2 = D900; 
d3 = D1800;
........... //Rest of coding

Now 300,900,1800 is the second for intraday . What I have to write in place of them for coding in Daily, 3day, 6day timeframe.. Please Help

function MyMTFfunc( timeframe, expandmode )
{
    TimeFrameSet( timeframe );
   
    a = TimeFrameCompress(StochK( periods = 14, ksmooth = 3 ),timeframe,compressLast);
    b = TimeFrameCompress(StochD( periods = 14, Ksmooth = 3, Dsmooth = 3 ),timeframe,compressLast);
    
    Plot( a, "A"+timeframe, ParamColor( "Color", colorCycle ), ParamStyle("Style") );
    Plot( b, "B"+timeframe, ParamColor( "Color", colorCycle ), ParamStyle("Style") );
    
    D1 = a<1000;
    TimeFrameRestore();

    VarSet( "K" + timeframe, TimeFrameExpand(TimeFrameCompress(a, timeframe, compressLast),timeframe,expandmode));
    VarSet( "D" + timeframe, TimeFrameExpand(TimeFrameCompress(b, timeframe, compressLast),timeframe, expandmode));

return TimeFrameExpand(TimeFrameCompress(D1, timeframe, compressLast),timeframe, expandmode);
}

expandmode = expandLast;
 MyMTFfunc( inDaily, expandmode );
 MyMTFfunc( 3*inDaily, expandmode );
 MyMTFfunc( 6*inDaily, expandmode );

Was able to  plot stochk/stochD charts for 1,3,6 days with base interval of 1day. let me know if it satisfies your requirement.

Regards

Vivith

www.neotradeanalytics.com

(authorised realtime data vendor of NSE supporting realtime data feeds to Amibroker,metastock and ninjatrader)

But u havent code variable K1 k2 k3 and d1 d2 d3. Anyways I solved this problem by myself. Thanks for ur effort.