AFL Scanner & Exploration

#1
Need to combine both the codes in one with the below concept - If first candle of the day breaks previous day high or low with SP4 or SP3 or SP2 or SP1 then it should show but or sell as per the condition captured below , Also if any candle of the day having SP4 volume then then particular candle color should change it to below, Please help
_SECTION_BEGIN("Volume and Breakout");
SetChartOptions(0, chartShowArrows | chartShowDates);

va = MA(V, 20);
sp4 = va * 7;
sp3 = va * 6;
sp2 = va * 5;
sp1 = va * 2.5;

star4 = V >= sp4;
star3 = V >= sp3;
star2 = V >= sp2;
star1 = V >= sp1;

// Set histogram color based on star rating
histColor = IIf(star4, colorViolet,
IIf(star3, colorYellow,
IIf(star2, colorBlue,
IIf(star1, colorGreen, colorRed))));

Plot( Volume, _DEFAULT_NAME(), histColor, ParamStyle("Style", styleHistogram | styleThick, maskHistogram ) );

PlotShapes(star1 * shapeSmallCircle, colorYellow, 0, 0, 5);
PlotShapes(star2 * shapeSmallCircle, colorYellow, 0, 0, 10);
PlotShapes(star3 * shapeSmallCircle, colorYellow, 0, 0, 15);
PlotShapes(star4 * shapeSmallCircle, colorYellow, 0, 0, 20); // Added shape for star4


_SECTION_END();
_SECTION_BEGIN("PDHBreakOut-Scanner");

TimeFrameSet(in5Minute);
//TimeFrameSet(inDaily);
xH = TimeFrameGetPrice("H",inDaily,-1);
xL = TimeFrameGetPrice("L",inDaily,-1);
va = MA(V, 20);
sp4 = va * 7;
sp3 = va * 6;
sp2 = va * 5;
sp1 = va * 3;
Session= int(TimeNum()/100) == 915;

//Filter=Session;

TimeFrameRestore();
TimeFrameSet(in5Minute);

Buy = (C > xH) AND (O < C) AND (C > sp4 OR C > sp3) AND Session;

Sell = (C < xL) AND (O > C) AND (C < sp4 OR C < sp3) AND Session;

TimeFrameRestore();

//_TRACEF("xL=%f,xH=%f, c5=%f,O5=%f",xL,xH,C5,O5);
//printf("xL=%f,xH=%f, c5=%f,O5=%f",xL,xH,C5,O5);
_SECTION_END();
 

Attachments

#2
if any candle closing with Sp4 that means with ma 20 period volume * 7 times then that particular candle color should change to blue, If its bullish - Hollow Blue , Bearish - Solid Blue
 

Similar threads