I'm not able to make explorer for with multiple time frame screaner

#1
SetChartBkColor(ParamColor("Panel Color",colorBlack));
SetChartBkGradientFill(ParamColor("Upper Chart",colorBlack),ParamColor("Lower Chart",colorBlack));
periods = Param( "Periods", 14, 1, 200, 1 );//8
Ksmooth = Param( "%K avg", 3, 1, 200, 1 );//3
Dsmooth = Param( "%D avg", 3, 1, 200, 1 );//4
_SECTION_BEGIN("Stochastic %D");

K0 = StochK( periods , Ksmooth);
D0 = StochD( periods , Ksmooth, DSmooth );
K0_Color = IIf (EMA (k0,5) < k0 AND EMA (d0 ,5) < d0 AND k0 > d0 ,colorYellow,
IIf (EMA (k0,5) > k0 AND EMA (d0 ,5) > d0 AND k0 < d0 ,colorRed,colorBlue));
Plot( StochD( periods , Ksmooth, DSmooth )," Stoch D0",colorGrey50,styleLine, styleLine);
Plot( StochK( periods , Ksmooth)," Stoch K0",K0_Color,styleLine, styleLine);

_SECTION_END();

//***************************************************************//

_SECTION_BEGIN("Stochastic_Int-1");
Int_1 = IIf( Interval() < in1Minute * 63, in1Minute * 63,
IIf( Interval() >= in1Minute * 63 AND Interval() < inDaily, inDaily, inWeekly));
TimeFrameSet( Int_1 );
k1 = StochK( periods , Ksmooth);
d1 = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();

K1 = TimeFrameExpand(k1, Int_1);
D1 = TimeFrameExpand(d1, Int_1);
Plot(K1, "Stoch K1", colorBlueGrey, styleDashed );

_SECTION_END();

//***************************************************************//

_SECTION_BEGIN("Stochastic_Int-2");
Int_2 = IIf( Interval() < inDaily, inWeekly, inMonthly);
TimeFrameSet( Int_2 );
k2 = StochK( periods , Ksmooth);
d2 = StochD( periods , Ksmooth, DSmooth );
TimeFrameRestore();

K2 = TimeFrameExpand(k2, Int_2);
D2 = TimeFrameExpand(d2, Int_2);
Plot(K2, "Stoch K2", colorGrey40, styleDashed );

BUY0 = Cross(K0 ,D0 ) AND ROC( K1,7) < 0 ;
BUY1 = Cross(K0 ,D0 ) AND ROC( K1,7) > 0;
Buy = BUY0+BUY1;
BUYC = IIf(BUY0,colorYellow, IIf(Buy1,colorGreen, Null));
PlotShapes( IIf(Buy,shapeUpArrow,Null), BUYC, 0, 20, 0 );

SELL0 = Cross(D0 ,K0 ) AND ROC( K1,7) > 0 AND ROC( K2 ,6) > 0;
SELL1 = Cross(D0 ,K0 ) AND ROC( K1,7) < 0 AND ROC( K2 ,6) > 0;
Sell = SELL0+SELL1;
SELLC = IIf(SELL0,colorOrange, IIf(SELL1,colorRed, Null));
PlotShapes( IIf(Sell,shapeDownArrow,Null), SELLC, 0, 80, 0 );

Filter = Close OR Buy;
AddColumn(Buy,"BUY",1);
AddColumn(Sell,"SELL,1);
_SECTION_END();
 

Similar threads