Log in

Search in this group

  • Groups
  • Which is the best algorithm for PFE ?

Which is the best algorithm for PFE ?

Which is the best algorithm for PFE ?

Owner: jaguar1637

Group members: 9

Description:

Hi

I was awaken several nights ago, by this idea. The PFE algorithm needed to be refined, bcoz it was wrong

So, I created a bunch of testing of several algorithm, one, from Hans Hunnula, the one from Gimapiero Raschetti, the one I calculated myself

the one from Hans Hannula is : 

Hans Hannula

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");   
The one from giampiero.raschetti

while(i>=0)
{
noise=0.000000001;
for(k=0;k
{
noise=noise+MathAbs((Close[i+k]) - (Close[i+k+1]) );
}
PfeBuffer[i]= (( Close[i]) - (Close[i+PfePeriod]))/noise;
i--;
}

i=Bars-PfePeriod-1;
if(counted_bars>=PfePeriod) i=Bars-counted_bars-1;

while(i>=0)
{
if(UseAvarage)
Pfe[i]=iMAOnArray(PfeBuffer,Bars,MaPeriod,0,MODE_EMA,i);
else
Pfe[i]=PfeBuffer[i];
i--;
}

 And myself, jeanyves Torres, that I checked by putting the MaMethod as SMMA, get rid of the noise value and based on Rate of Change

for (int i = counted_bars - 1; i >= 0; i--)
{
pfe1 = MathSqrt(MathPow(Close[i] - (Close[i + PFE_period]), 2) + MathPow(PFE_period, 2));
Sum = 0;
for (int count = 0; count < PFE_period; count++)
Sum += MathSqrt(MathPow(Close[i + count] - (Close[i + count + 1]), 2) + 1.0);
if (Close[i] > Close[i + PFE_period])
flag = 1;
else
flag = -1;
PfeBuffer[i] = 100 * flag * pfe1 / Sum;
}
for (i = counted_bars; i >= 0; i--)
Pfe[i] = iMAOnArray(PfeBuffer, 0, smooth, 0, MaMethod, i);

Brief description: PFE