#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 Gold
//--------------------------------------
extern int p=48;
extern bool SA=false;
extern bool SPR=false;
//--------------------------------------
double hh[],ll[],ss[];
double spr;
//*******************************************
int init()
{
SetIndexBuffer(0,hh);
SetIndexBuffer(1,ll);
SetIndexBuffer(2,ss);
return(0);
}
//*******************************************
int start()
{
int cbi,IC=IndicatorCounted();
if (Bars-IC<3) cbi=Bars-IC-1; else
{
if (SPR) spr=MarketInfo(Symbol(),MODE_SPREAD)*Point; else spr=0.0;
cbi=Bars-p-1;
}
//------------------------------------
for(int i=cbi; i>=0; i--)
{
hh[i]=High[iHighest(NULL,0,MODE_HIGH,p,i)]+spr;
ll[i]=Low[iLowest(NULL,0,MODE_LOW,p,i)];
if (SA) ss[i]=(hh[i]+ll[i])/2;
}
//------------------------------------
return(0);
}
//********************************************
Comments