projected high and projected low afl

#1
Hi,
I saw some blogs giving projected high and projected low for next day using current day data, i had the excel sheet long back, so i created the afl for the same. the accuracy is more than 60 percent, no system is 100 percent correct.

buy between the previous low and projected low
sell between the previous high and projected high

Code:
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

congestion = (High>Ref(High,-1) AND Low<Ref(Low,-1) AND High<Ref(High,-1) AND Low<Ref(Low,-1)) OR Open > Ref(High,-1) OR Open<Ref(Low,-1);
uptrend = Low>Ref(Low,-1) AND High>Ref(High,-1) AND NOT Open > Ref(High,-1);
downtrend = Low<Ref(Low,-1) AND High<Ref(High,-1) AND NOT Open<Ref(Low,-1) ;
pivot = (Open+High+Low+(2*Close))/5;
avgrange =((High-Low)+(Ref(High,-1)-Ref(Low,-1)))/2;




pl1 = (2*pivot)-High;
ph1 = (2*pivot)-Low;




pl2 = ((2*pivot)-Low)-avgrange;
ph2 = Low+(High-Ref(Low,-1));


pl3 = Low-(Ref(High,-1)-Low);
ph3 =((2*pivot)-High)+avgrange;




WriteIf(Congestion,"projectlow:"+(pl1),WriteIf(uptrend,"projectlow:"+(pl2),WriteIf(downtrend,"projectlow:"+(pl3),"")));
WriteIf(Congestion,"projecthigh:"+(ph1),WriteIf(uptrend,"projecthigh:"+(ph2),WriteIf(downtrend,"projecthigh:"+(ph3),"")));



GfxSetOverlayMode( mode = 0 ); 
GfxSelectPen( colorOrange, 2 ); 
GfxSelectSolidBrush( colorBlack ); 
GfxRoundRect(5,20, 175,100, 16, 20 ); 
GfxSetBkMode(1); 
GfxSelectFont( "Arial",12, 700, False ); 
GfxSetTextColor( colorPaleGreen );
GfxSetTextAlign(0);

GfxSetTextColor( colorWhite );

GfxTextOut(WriteIf(Congestion,"projectlow:"+(pl1),WriteIf(uptrend,"projectlow:"+(pl2),WriteIf(downtrend,"projectlow:"+(pl3),""))), 8 ,45 );
GfxTextOut(WriteIf(Congestion,"projecthigh:"+(ph1),WriteIf(uptrend,"projecthigh:"+(ph2),WriteIf(downtrend,"projecthigh:"+(ph3),""))), 8 ,25 );



GfxSetTextColor( colorWhite);

GfxTextOut(WriteIf(congestion, "TREND:congestion",""), 8 ,65 );
GfxTextOut(WriteIf(uptrend, "TREND:uptrend",""), 8 ,65 );
GfxTextOut(WriteIf(downtrend, "TREND:downtrend",""), 8 ,65 );

GfxSetTextColor( colorRed );

Plot(pl1,"projected low",colorRed);
Plot(ph1,"projected high",colorBlue);
Plot(pl2,"projected low",colorRed);
Plot(ph2,"projected high",colorBlue);
Plot(pl3,"projected low",colorRed);
Plot(ph3,"projected high",colorBlue);
_SECTION_END();
 
#2
Would you please explain what are pl1, pl2, pl3... its written all as projected low

Please check the conditions for congestion is it ok?
 
Last edited:
#3
Hi,
i copied the formula from excel sheet, pl1 is the projected low when the condition is congestion,pl2 is the projected low when the condition is uptrend,pl3 is projected low when the trend is downtrend, you will get the value in the rectangle box


Please check the conditions for congestion is it ok?
the data here iam using only 2 day values (today and previous day) and hence it is the formula.
 
#4
Hi,
i copied the formula from excel sheet, pl1 is the projected low when the condition is congestion,pl2 is the projected low when the condition is uptrend,pl3 is projected low when the trend is downtrend, you will get the value in the rectangle box


Please check the conditions for congestion is it ok?
the data here iam using only 2 day values (today and previous day) and hence it is the formula.
 
#5
congestion = (High>Ref(High,-1) AND Low<Ref(Low,-1) AND High<Ref(High,-1) AND Low<Ref(Low,-1))

Look at the first condition: High > Ref(High,-1) and it is joined with High < Ref(High,-1)

This will never evaluate true ! Also wht is the point of repeating Low < Ref(Low,-1) twice

Maybe you share with us the resource and we check the code.
 
#7
congestion = (High>Ref(High,-1) AND Low<Ref(Low,-1)) or (High<Ref(High,-1) AND Low<Ref(Low,-1)) OR Open > Ref(High,-1) OR Open<Ref(Low,-1);

it should be "OR", not "AND", thanks for pointing out
 

Similar threads