Performance_Index Indicator For MT5

Performance_Index Indicator For MT5

The Performance_Index Indicator For MT5 is a trend indicator that that compares the trend of a certain symbol (currency pair) with a general trend of a benchmark index.


The indicator plots a red line on an indicator chart below the main trading chart showing the ratio of the indices between the benchmarked index and that of the current symbol. The trader has the freedom of choosing the benchmark instrument that he/she would like to use. He or she can change the benchmark instrument in the inputs parameters of the indicator which include:

•Method – it is the calculation method
•Period – it is the calculation period
•Instrument – it is the benchmark instrument
•Applied price – it is the calculation price


The benchmark instrument is normally displayed at the top left corner of the indicator chart next to the indicator's name. However, it is worth noting that the symbol that is chosen as the benchmark should exist in the server and should have an adequate history for a proper display to occur. If there is no sufficient history of the benchmark symbol, the indicator will delay as it waits for the history to be downloaded.


This indicator can be used with any symbol (currency pair).

FREE Performance_Index Indicator

Download the FREE Performance_Index Indicator for MT5.

To receive my email 100% sure: 
Put my email on your whitelist!

 

Partially Automated Trading Besides Your Day Job

Alerts In Real-Time When Divergences Occur

My Recommended MT4/MT5 Broker

 

Installing the Performance_Index 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 Performance_Index.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 Performance_Index Indicator For MT5

The Performance_Index Indicator For MT5 has 4 parameters to configure.

input uint                 InpPeriod         =  14;            // Period
input ENUM_MA_METHOD       InpMethod         =  MODE_SMA;      // Method
input ENUM_APPLIED_PRICE   InpAppliedPrice   =  PRICE_CLOSE;   // Applied price
input string               InpSymbol         =  "GBPUSD";      // Instrument

Buffers of the Performance_Index Indicator For MT5

The Performance_Index Indicator For MT5 provides 5 buffers.

SetIndexBuffer(0,BufferPI,INDICATOR_DATA);
SetIndexBuffer(1,BufferMA1,INDICATOR_CALCULATIONS);
SetIndexBuffer(2,BufferMA2,INDICATOR_CALCULATIONS);
SetIndexBuffer(3,BufferPr1,INDICATOR_CALCULATIONS);
SetIndexBuffer(4,BufferPr2,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[])
  {
//--- @ gt 25@:0 =0  lt 8=8 lt 0;L= gt 5 : gt ;85AB2 gt  10@ gt 2 4;O @0AGQB0
   int bars2=(InpSymbol==Symbol() ? rates_total : Bars(InpSymbol,PERIOD_CURRENT));
   if(rates_total lt 4 || bars2 lt 4) return 0;
//--- #AB0= gt 2:0  lt 0AA82 gt 2 1CD5@ gt 2 :0: B09 lt A5@89
   ArraySetAsSeries(time,true);
//--- @ 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-1;
      ArrayInitialize(BufferPI,EMPTY_VALUE);
      ArrayInitialize(BufferMA1,0);
      ArrayInitialize(BufferMA2,0);
      ArrayInitialize(BufferPr1,0);
      ArrayInitialize(BufferPr2,0);
     }
   int limit_min=fmin(rates_total,bars2)-1;
//---  gt 43 gt B gt 2:0 40==KE
   int copied=0,count=(limit==0 ? 1 : limit_min);
   copied=CopyBuffer(handle_ma1,0,0,count,BufferMA1);
   if(copied!=count) return 0;
   copied=CopyBuffer(handle_ma2,0,0,count,BufferMA2);
   if(copied!=count) return 0;
//---
   copied=CopyBuffer(handle_pr1,0,0,count,BufferPr1);
   if(copied!=count) return 0;
   copied=CopyBuffer(handle_pr2,0,0,count,BufferPr2);
   if(copied!=count) return 0;
//---  0AGQB 8=48:0B gt @0
   count=(limit==0 ? limit : limit_min);
   for(int i=count; i gt =0 && !IsStopped(); i--)
     {
      int index=BarShift(InpSymbol,PERIOD_CURRENT,time[i],false);
      if(index==WRONG_VALUE) continue;
      double MA1=BufferMA1[i];
      double MA2=BufferMA2[i];
      double Pr1=BufferPr1[i];
      double Pr2=BufferPr2[i];
      BufferPI[i]=(MA2!=0 && Pr2!=0 ? Pr1*MA2/(Pr2*MA1) : EMPTY_VALUE);
     }

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| @ gt 25@:0 A8 lt 2 gt ;0                                                 |
//+------------------------------------------------------------------+
bool SymbolCheck(const string symbol_name)
  {
   long select=0;
   ResetLastError();
   if(!SymbolInfoInteger(symbol_name,SYMBOL_SELECT,select))
     {
      int err=GetLastError();
      Print("Error: ",err," Symbol ",symbol_name," does not exist");
      return false;
     }
   else
     {
      if(select) return true;
      ResetLastError();
      if(!SymbolSelect(symbol_name,true))
        {
         int err=GetLastError();
         Print("Error selected ",symbol_name,": ",err);
        }
     }
   return false;
  }
//+------------------------------------------------------------------+
//|  gt 72@0I05B A lt 5I5=85 10@0 ? gt  2@5 lt 5=8                              |
//| https://www.mql5.com/ru/forum/743/page11#comment_7010041         |
//+------------------------------------------------------------------+
int BarShift(const string symbol_name,const ENUM_TIMEFRAMES timeframe,const datetime time,bool exact=false)
  {
   int res=Bars(symbol_name,timeframe,time+1,UINT_MAX);
   if(exact) if((timeframe!=PERIOD_MN1 || time gt TimeCurrent()) && res==Bars(symbol_name,timeframe,time-PeriodSeconds(timeframe)+1,UINT_MAX)) return(WRONG_VALUE);
   return res;
  } 
//+------------------------------------------------------------------+

 

About Me

I'm Mike Semlitsch the owner of PerfectTrendSystem.com. My trading career started in 2007. Since 2013 I have helped thousands of traders to take their trading to the next level. Many of them are now constantly profitable traders. 

The following performance was achieved by me while trading live in front of hundreds of my clients:

Connect With Me:  

Results From 5 Months!
This service starts soon! Be the first who get's notified when it begins!

This FREE Indicator Can Transform
Your Trading!

FREE Indicator + Telegram Group


Request the Ultimate Double Top/Bottom Indicator which is used by 10,000+ traders.