Hi,
Make sure you set base interval of your charts/scan to <=5mins as u have few conditions which are in 5mins interval. If you set the timeframe >5mins, you might not get the expected result. Attaching the basic AFL which u can add and check in charts with TimeFrame set from <=5mins
Ā
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();
_SECTION_BEGIN("Multi Time Frame Stoch Trading");
timeframeset(in1minute*30);
//Buy condition in 30mins
condition1=stochK(8,5)>stochD(8,5,3);
//Sell Condition in 30mins
condition1_1 = stochK(8,5)<StochD(8,5,3);
timeframerestore();
timeframeset(in5minute);
//Buy Condtion in 5mins interval
condition2=stochK(8,5)>stochD(8,5,3);
//Sell Condition in 5mins Interval
condition2_1 = stochK(8,5)<StochD(8,5,3);
timeframerestore();
Buy=condition1 and condition2;
Sell = condition1_1 AND condition2_1;
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
_SECTION_END();