//-[HighLowBands.mq4]

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 Aqua
#property indicator_color2 Violet

extern int LookBackPeriod =20;

double UBBuffer[];
double LBBuffer[];

int init(){

IndicatorBuffers(2);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,UBBuffer);

SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,LBBuffer);

return(0);}

int start(){

int counted_bars=IndicatorCounted();
int i;

if(Bars<=LookBackPeriod) return(0);

if(counted_bars<1)
for(i=1;i<=LookBackPeriod;i++)
{
UBBuffer[Bars-i]=EMPTY_VALUE;
LBBuffer[Bars-i]=EMPTY_VALUE;
}

int limit=Bars-counted_bars;
if(counted_bars>0) limit++;

i=Bars-LookBackPeriod+1;

if(counted_bars>LookBackPeriod-1) i=Bars-counted_bars-1;

while(i>=0)
{
UBBuffer[i]=High[Highest(NULL,0,MODE_HIGH,LookBackPeriod,i)];
LBBuffer[i]=Low[Lowest(NULL,0,MODE_LOW,LookBackPeriod,i)];i--;
}
return(0);}


メガ倉庫のやつですエラー修正しときました。動作ok