// Downloaded From https://www.WiseStockTrader.com
/*Polarized Fractal Efficiency

The January 1994 issue of Stocks & Commodities featured an article by Hans Hannula on Polarized Fractal Efficiency. Here is the custom formula for creating the five-period smoothed 10-Day PFE using AmiBroker:*/
                     
pds=10; 
x=sqrt((ROC(C,9)*ROC(C,9))+100);
y=Sum(sqrt((ROC(C,1)* ROC(C,1))+1),pds);
z=(x/y);
pfe=EMA(IIf(C>Ref(C,-9),z,-z)*100,5);

Plot(pfe,"PFE",IIf(pfe>Ref(pfe,-1),colorGreen,colorRed),styleHistogram); 

"PFE" +WriteIf(pfe>10, " Indicates an upward Trend",WriteIf(pfe>-10 AND pfe<10, "  Indicates a Consolidation Phase is in place", " Indicates a downward Trend "))+WriteIf(pfe>Ref(pfe,-1),"\n The Indicator is currently Rising which indicates a strengthening Up Trend or weakening Down Trend", "\n The indicator is currently falling which indicates a weakening uptrend or a trengthening Down Trend");