Need Intraday Buy and Sell indicator for Metastock

#35
SECTION_BEGIN("Stochastic_30_MINS");
periods = Param( "Periods", 8, 1, 200, 1 );
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );
Dsmooth = Param( "%D avg", 4, 1, 200, 1 );

TimeFrameSet(in1Minute * 30);
k30 = StochK( periods , Ksmooth);
d30 = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();

K = TimeFrameExpand(k30, in1Minute * 30);
D = TimeFrameExpand(d30, in1Minute * 30);

Plot(D, "D", colorRed, styleThick );
Plot(K, "K", colorBlue, styleThick );

Hi = IIf(k > d, k, d);
Lo = IIf(k < d, k, d);

COLOR = IIf(Ref(d,1) > Ref(k,1), colorRed, colorBlue);
//COLOR = IIf(K > D AND (K > 80 OR D > 80) OR D > K AND (K < 20 OR D <20), colorLightGrey, COLOR);

PlotOHLC(Lo,Hi,Lo,Hi,"",COLOR, styleNoLabel | styleCloud);

_SECTION_END();

Hi this is d formula for trading....
Kindly advice 4 improvement