Category Oscilators  Published on 01/02/2023

Polarized Fractal Efficiency indicator

Description

The Polarized Fractal Efficiency indicator is designed for identifying trend from deriving fast and slow ROC indicator values

The term polarized fractal efficiency (PFE) refers to a technical indicator that is used to determine the price efficiency for an investment over a user-defined period. It fluctuates between -100 and 100 where the centerline is at zero. Traders can use the PFE to see where a security they're interested in is headed. The price shows an upward trend if the PFE goes above zero and a downward trend if it drops below zero. The indicator was developed by author, engineer, programmer, and trader Hans Hannula.

The polarized fractal efficiency indicator was developed by author, engineer, programmer, and trader Hans Hannula. The idea was first mentioned in 1994 in the January issue of Technical Analysis of Stocks & Commodities magazine. It fluctuates between -100 and +100, with zero as the centerline. Securities with a PFE greater than zero trend up, while a reading of less than zero indicates a downward trend.

The PFE indicator measures the strength of a trend by its position relative to the zero line. As a general rule, the further the PFE value is away from zero, the stronger and more efficient the given trend is. A PFE value that fluctuates around the zero line could indicate that the supply and demand for the security are in balance and the price may trade sideways.

Strategies that generally use the PFE as a signal consider a buy sign as a reversal in the direction of the indicator and its movement from its minimum value to zero. A signal to close a position arises as the value of the indicator reaches its peak above zero. An indicator shift from peak to zero presents a sell signal. As a rule of thumb, traders should buy to cover all short positions after the indicator forms a new minimum.

In this link you can find the indicator as Chart indicator: https://ctrader.com/algos/indicators/show/3530



using System;
using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.API.Indicators;
using cAlgo.Indicators;

namespace cAlgo
{
    [Levels(-100, -50, 0, 50, 100)]
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class mPFE : Indicator
    {
        [Parameter("PeriodFastROC (7)", DefaultValue = 1, MinValue = 1)]
        public int PeriodFastROC { get; set; }
        [Parameter("PeriodSlowROC (9)", DefaultValue = 9, MinValue = 3)]
        public int PeriodSlowROC { get; set; }
        [Parameter("PeriodMA (5)", DefaultValue = 5, MinValue = 1)]
        public int PeriodMA { get; set; }
        [Parameter("PDS (710)", DefaultValue = 10, MinValue = 1)]
        public int PDS { get; set; }
        [Parameter("MA Type", DefaultValue = MovingAverageType.Exponential)]
        public MovingAverageType MAType { get; set; }

        [Output("olarized Fractal Efficiency", LineColor = "Black", PlotType = PlotType.Line, Thickness = 1)]
        public IndicatorDataSeries outPFE { get; set; }


        private IndicatorDataSeries _raw;
        private IndicatorDataSeries _pfe;
        private MovingAverage _pfema;
        double slow, fast, x, y, z;


        protected override void Initialize()
        {
            _raw = CreateDataSeries();
            _pfe = CreateDataSeries();
            _pfema = Indicators.MovingAverage(_raw, PeriodMA, MAType);
        }

        public override void Calculate(int i)
        {
            slow = (Bars.ClosePrices[i + PeriodSlowROC] != 0 ? 100.0 * (Bars.ClosePrices[i] / Bars.ClosePrices[i + PeriodSlowROC] - 1) : 0);
            fast = (Bars.ClosePrices[i + PeriodFastROC] != 0 ? 100.0 * (Bars.ClosePrices[i] / Bars.ClosePrices[i + PeriodFastROC] - 1) : 0);
            x = Math.Sqrt(slow * slow + 100.0);
            y = Math.Sqrt(fast * fast + 1.0) + PDS;
            z = x / (y != 0 ? y : 1);
            _raw[i] = (Bars.ClosePrices[i] > Bars.ClosePrices[i + PeriodSlowROC] ? 100.0 * z : -100.0 * z);

            outPFE[i] = _pfema.Result[i];
        }
    }
}


mfejza's avatar
mfejza

Joined on 25.01.2022

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: mPFE.algo
  • Rating: 5
  • Installs: 625
  • Modified: 31/01/2023 23:31
Comments
Log in to add a comment.
No comments found.