PFE_Overlay Indicator For MT5
The PFE_Overlay Indicator For MT5 has been designed to identifying price trends. It is based on the relationship of price with a fast and a slow Rate of Change indicator. The main Polarized Fractal Efficiency (PFE) indicator gets overlaid on price chart as a Teal colored line, with two Red lines of the Standard Deviation value calculated. The PFE_Overlay Indicator For MT5 can be used for intraday, swing and momentum trading of any liquid financial instrument. Basic signals generated are explained below: 1. When price closes above the upper Red line, it suggests that the immediate trend has turned bullish. Traders can initiate long positions when price breaches the high of the candlestick that closed outside the upper Red line. 2. If price closes below the lower Red line, it indicates that the immediate trend has changed to bearish. Traders can enter short as and when price pierces through the low of the candlestick that closed beneath the lower Red line.
Installing the PFE_Overlay Indicator For MT5
After you downloaded the indicator via the form above you need to unzip the zip-file. Then you need to copy the file PFE_Overlay.mq5 into the folder MQL5\Indicators of your MT5 installation. After that please restart MT5 and then you will be able to see the indicator in the list of indicators.
Parameters of the PFE_Overlay Indicator For MT5
The PFE_Overlay Indicator For MT5 has 7 parameters to configure.
input uint InpPeriodFastROC = 1; // Fast ROC period
input uint InpPeriodSlowROC = 9; // Slow ROC period
input uint InpPeriodMA = 5; // MA period
input int InpPDS = 10; // PDS
input uint InpPeriodAVG = 20; // Avg period
input double InpDeviation = 2.0; // Deviation
input ENUM_INPUT_YES_NO InpShowDev = INPUT_YES; // Show deviations
Buffers of the PFE_Overlay Indicator For MT5
The PFE_Overlay Indicator For MT5 provides 9 buffers.
SetIndexBuffer(0,BufferPFE,INDICATOR_DATA);
SetIndexBuffer(1,BufferTop,INDICATOR_DATA);
SetIndexBuffer(2,BufferBottom,INDICATOR_DATA);
SetIndexBuffer(3,BufferTL,INDICATOR_CALCULATIONS);
SetIndexBuffer(4,BufferBL,INDICATOR_CALCULATIONS);
SetIndexBuffer(5,BufferMA,INDICATOR_CALCULATIONS);
SetIndexBuffer(6,BufferDev,INDICATOR_CALCULATIONS);
SetIndexBuffer(7,BufferRAW,INDICATOR_CALCULATIONS);
SetIndexBuffer(8,BufferAvgRAW,INDICATOR_CALCULATIONS);
Main Parts Of The Code
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
//--- #AB0= gt 2:0 lt 0AA82 gt 2 1CD5@ gt 2 :0: B09 lt A5@89
ArraySetAsSeries(close,true);
//--- @ gt 25@:0 8 @0AGQB : gt ;8G5AB20 ?@ gt AG8BK205 lt KE 10@ gt 2
if(rates_total lt fmax(period_max,4)) return 0;
//--- @ gt 25@:0 8 @0AGQB : gt ;8G5AB20 ?@ gt AG8BK205 lt KE 10@ gt 2
int limit=rates_total-prev_calculated;
if(limit gt 1)
{
limit=rates_total-period_max-1;
ArrayInitialize(BufferPFE,EMPTY_VALUE);
ArrayInitialize(BufferTop,EMPTY_VALUE);
ArrayInitialize(BufferBottom,EMPTY_VALUE);
ArrayInitialize(BufferTL,0);
ArrayInitialize(BufferBL,0);
ArrayInitialize(BufferMA,0);
ArrayInitialize(BufferDev,0);
ArrayInitialize(BufferRAW,0);
ArrayInitialize(BufferAvgRAW,0);
}
//--- gt 43 gt B gt 2:0 40==KE
int count=(limit gt 1 ? rates_total : 1),copied=0;
copied=CopyBuffer(handle_ma,0,0,count,BufferMA);
if(copied!=count) return 0;
copied=CopyBuffer(handle_dev,0,0,count,BufferDev);
if(copied!=count) return 0;
for(int i=limit; i gt =0 && !IsStopped(); i--)
{
BufferTL[i]=BufferMA[i]+deviation*BufferDev[i];
BufferBL[i]=BufferMA[i]-deviation*BufferDev[i];
BufferTop[i]=(InpShowDev ? BufferTL[i] : EMPTY_VALUE);
BufferBottom[i]=(InpShowDev ? BufferBL[i] : EMPTY_VALUE);
double ROCSlow=(close[i+period_sroc]!=0 ? 100.0*(close[i]/close[i+period_sroc]-1) : 0);
double ROCFast=(close[i+period_froc]!=0 ? 100.0*(close[i]/close[i+period_froc]-1) : 0);
double x=sqrt(ROCSlow*ROCSlow+100.0);
double y=sqrt(ROCFast*ROCFast+1.0)+pds;
double z=x/(y!=0 ? y : 1);
BufferRAW[i]=(close[i] gt close[i+period_sroc] ? 100.0*z : -100.0*z);
}
if(ExponentialMAOnBuffer(rates_total,prev_calculated,0,period_ma,BufferRAW,BufferAvgRAW)==0)
return 0;
//--- 0AGQB 8=48:0B gt @0
for(int i=limit; i gt =0 && !IsStopped(); i--)
{
double scale=(BufferTL[i]!=BufferBL[i] ? 200.0/(BufferTL[i]-BufferBL[i]) : 0);
BufferPFE[i]=(scale!=0 ? BufferBL[i]+(100.0+BufferAvgRAW[i])/scale : EMPTY_VALUE);
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+