Hi,
can anyone give a help of hand here to fix the compiling error of this simple MA Pips Envelope indicator...here is the code
can anyone give a help of hand here to fix the compiling error of this simple MA Pips Envelope indicator...here is the code
Inserted Code
//+------------------------------------------------------------------+
//| Pips Envelopes.mq5 |
//| Kuldeep S Rathore |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright :copyright: 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//---- indicator settings
#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 DodgerBlue
#property indicator_color2 DodgerBlue
//---- indicator parameters
input int MA_Period=200;
input int MA_Shift=0;
input int MA_Method=1;
input int Applied_Price=0;
input double Distance_in_pips=5;
//---- indicator buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//----
int ExtCountedBars=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
int draw_begin;
//---- drawing settings
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);
SetIndexShift(0,MA_Shift);
SetIndexShift(1,MA_Shift);
IndicatorSetInteger(INDICATOR_DIGITS, MarketInfo(Symbol(), MODE_DIGITS));
if(MA_Period<2) MA_Period=14;
draw_begin=MA_Period-1;
//---- indicator short name
IndicatorSetString(INDICATOR_SHORTNAME, "Env("+string(MA_Period)+")");
SetIndexLabel(0,"Env("+string(MA_Period)+")Upper");
SetIndexLabel(1,"Env("+string(MA_Period)+")Lower");
SetIndexDrawBegin(0,draw_begin);
SetIndexDrawBegin(1,draw_begin);
//---- indicator buffers mapping
SetIndexBuffer(0, ExtMapBuffer1);
SetIndexBuffer(1, ExtMapBuffer2);
//---- initialization done
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
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[])
{
int limit;
if(rates_total <= MA_Period) return(0);
ExtCountedBars=IndicatorCounted();
//---- check for possible errors
if (ExtCountedBars<0) return(-1);
//---- last counted bar will be recounted
if (ExtCountedBars>0) ExtCountedBars--;
limit=rates_total-ExtCountedBars;
//---- EnvelopesM counted in the buffers
for(int i=0; i<limit; i++)
{
ExtMapBuffer1[i] = (1+Distance_in_pips*Point/Bid*10)*iMA(NULL, 0, MA_Period, 0, MA_Method, Applied_Price, i);
ExtMapBuffer2[i] = (1-Distance_in_pips*Point/Bid*10)*iMA(NULL, 0, MA_Period, 0, MA_Method, Applied_Price, i);
}
//---- done
return(rates_total);
} Regret is Brutal