Announcement

Collapse
No announcement yet.

PFE indicator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PFE indicator

    Could someone who understands .efs better than I do, take a look at this formula. Its real time plotting changes if you reload it. I really like this indicator. It would be great if someone could get it to plot correctly in real time.

    Thanks for any help!

    Steve

    EFS Code:

    code:





    / **************************************************

    *****************

    Description : This Indicator plots PFE (Polarized Fractal Efficiency) indicator

    Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002

    **************************************************

    ******************/



    function preMain()

    {

    setStudyTitle("Polarized Fractal Efficiency");

    setCursorLabelName("EMA", 0);

    setCursorLabelName("BUYZONE", 1);

    setCursorLabelName("SELLZONE", 2);

    setDefaultBarFgColor(Color.aqua, 0);

    setDefaultBarFgColor(Color.blue, 1);

    setDefaultBarFgColor(Color.red, 2);

    }

    var First = true;

    var EMA = 0.0;



    var EMA_1 = 0.0;

    function main()

    {

    var PFE = 0.0;

    var C2C = 0.0;

    var Counter = 0;

    var FracEff = 0.0;

    var Close = getValue("Close", 0, -10);

    PFE = Math.sqrt(Math.pow((Close[0] - Close[9]),2) + 100);

    for (Counter = 1; Counter < 10; Counter++)

    {

    C2C += Math.sqrt(Math.pow((Close[Counter - 1] - Close[Counter]), 2) + 1);

    }

    if ((Close[0] - Close[9]) > 0) FracEff = Math.round((PFE / C2C) * 100);

    else FracEff = Math.round(-(PFE / C2C) * 100);

    if (First)

    {

    EMA = FracEff;

    First = false;

    }

    else EMA = Math.round(FracEff * 0.333 + EMA_1 * (1 - 0.333));

    if (getBarState() == BARSTATE_NEWBAR) EMA_1 = EMA;

    return new Array(EMA, 50, -50);

    }

  • #2
    Re: PFE indicator

    Steve
    The reason for the behavior you are seeing is due to an incorrect placement of the routine that assigns at each new bar the values of EMA to EMA_1 which needs to be placed before EMA is calculated and not after
    If you search the forums for the keyword PFE you should find a thread related to this issue as it has been discussed in the past IIRC.
    As an aside you will also find more up to date versions of the same indicator
    Alex


    Originally posted by opstock
    Could someone who understands .efs better than I do, take a look at this formula. Its real time plotting changes if you reload it. I really like this indicator. It would be great if someone could get it to plot correctly in real time.

    Thanks for any help!

    Steve

    EFS Code:

    code:





    / **************************************************

    *****************

    Description : This Indicator plots PFE (Polarized Fractal Efficiency) indicator

    Provided By : Developed by TS Support, LLC for eSignal. (c) Copyright 2002

    **************************************************

    ******************/



    function preMain()

    {

    setStudyTitle("Polarized Fractal Efficiency");

    setCursorLabelName("EMA", 0);

    setCursorLabelName("BUYZONE", 1);

    setCursorLabelName("SELLZONE", 2);

    setDefaultBarFgColor(Color.aqua, 0);

    setDefaultBarFgColor(Color.blue, 1);

    setDefaultBarFgColor(Color.red, 2);

    }

    var First = true;

    var EMA = 0.0;



    var EMA_1 = 0.0;

    function main()

    {

    var PFE = 0.0;

    var C2C = 0.0;

    var Counter = 0;

    var FracEff = 0.0;

    var Close = getValue("Close", 0, -10);

    PFE = Math.sqrt(Math.pow((Close[0] - Close[9]),2) + 100);

    for (Counter = 1; Counter < 10; Counter++)

    {

    C2C += Math.sqrt(Math.pow((Close[Counter - 1] - Close[Counter]), 2) + 1);

    }

    if ((Close[0] - Close[9]) > 0) FracEff = Math.round((PFE / C2C) * 100);

    else FracEff = Math.round(-(PFE / C2C) * 100);

    if (First)

    {

    EMA = FracEff;

    First = false;

    }

    else EMA = Math.round(FracEff * 0.333 + EMA_1 * (1 - 0.333));

    if (getBarState() == BARSTATE_NEWBAR) EMA_1 = EMA;

    return new Array(EMA, 50, -50);

    }

    Comment


    • #3
      Great, Thank you Alex. I searched for it before, but could only find the same old version. I wasn't searching in the right forum, I guess.

      Thanks again,

      Steve

      Comment


      • #4
        Steve
        You are welcome
        Alex


        Originally posted by opstock
        Great, Thank you Alex. I searched for it before, but could only find the same old version. I wasn't searching in the right forum, I guess.

        Thanks again,

        Steve

        Comment

        Working...
        X