Exibir indicador personalizado


Boa tarde eu personalizei um indicador existente, porém ao adicionar ao MT5 o indicador nao é exibido na janela.


//|                                                           MR.mq5 |

//|                                                 Alexandre Jùnior |

//|                                              http://www.mql5.com |


#property copyright   "Alexandre Júnior"

#property link        "http://www.mql5.com"

#property version     "1.00"

#property description "Média Rápida"

#include <MovingAverages.mqh>

#property indicator_chart_window

#property indicator_buffers 2

#property indicator_plots   1

//--- plot ExtMRBuffer

#property indicator_label1  "MR"

#property indicator_type1   DRAW_LINE

#property indicator_color1  Yellow

#property indicator_style1  STYLE_SOLID

#property indicator_width1  2

//--- default applied price

#property indicator_applied_price PRICE_CLOSE

//--- input parameters

input int InpPeriodMR=8;      // MR period

input int InpShiftMR=0;        // MR shift

//--- indicator buffer

double    ExtMRBuffer[];

double    ExtMRBuffer2[];

double    ExtFastSC;

int       ExtPeriodMR;

int       InpMRPeriod;

int       ExtMRPeriod;


//| MR initialization function                                      |


void OnInit()


//--- check for input values




      PrintFormat("Input parameter InpPeriodMR has incorrect value (%d). Indicator will use value %d for calculations.",






//--- indicator buffers mapping


//--- set accuracy


//--- sets first bar from what index will be drawn


//--- set index shift


//--- set shortname and change label

   string short_name=StringFormat("MR(%d)",ExtPeriodMR);





//| AMA iteration function                                           |


int OnCalculate(const int rates_total,

                const int prev_calculated,

                const int begin,

                const double &price[])


   int i;

//--- check for rates count



//--- draw begin may be corrected



//--- detect position

   int pos=prev_calculated-1;

//--- first calculations




      for(i=0; i<pos-1; i++)




//--- main cycle

   for(i=pos; i<rates_total && !IsStopped(); i++)


      //--- calculate MR





            //--- Calculate StdDev




//--- return value of prev_calculated for next call




//| Calculate DESV value                                               |


double StdDevFunc(const double &price[],const double &ma_price[],const int position)


   double dev=0.0;

   for(int i=0; i<ExtMRPeriod; i++)






Descubra novos recursos para o MetaTrader 5 com a comunidade e os serviços MQL5
Descubra novos recursos para o MetaTrader 5 com a comunidade e os serviços MQL5
  • www.mql5.com
One Click Close The script allows users to easily close positions if their profit/loss reaches or exceeds a value specified in pips. Please set slippage value first. Sometimes some positions do not close due to high volatility of the market. Please set larger slippage or restart the script. The free demo version is: ...