Exibir indicador na Janela Principal


Bom dia, eu modifiquei um indicador para exibir na tela principal em vez de janela separada, porem, nao exibe a linha do indicador.

#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 InpMRPeriod=8;      // MR period

input int InpMRShift=0;        // MR shift

//--- indicator buffer

double    ExtMRBuffer[];

double    ExtMRBuffer2[];

int       ExtMRPeriod;

int       ExtMRShift;


//| MR initialization function                                      |


void OnInit()


//--- check for input values




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








      printf("Incorrect value for input variable InpStdDevShift=%d. Indicator will use value=%d for calculations.",InpMRShift,ExtMRShift);


   else ExtMRShift=InpMRShift;


//--- 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)",ExtMRPeriod);





//| AMA iteration function                                           |


int OnCalculate(const int rates_total,

                const int prev_calculated,

                const int begin,

                 const double &price[])


  int       pos;

//--- check for rates count

//--- draw begin may be corrected




//--- detect position


//--- first calculations








//--- main cycle

   for( int 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[],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: ...