Loop on stock list calling iRSI, iTEMA and iBANDS

 

I did that 3 scripts and that's working! But my CPU usage is going to 99%! Even i remove the EA!

This scripts are working ontick! I will show here one!

void OnTick()
  {
  int h=FileOpen("ind/bol.csv",FILE_WRITE|FILE_CSV,";");
   double high[];
   double mid[];
   double low[];
   ArraySetAsSeries (high,true);
   ArraySetAsSeries (mid,true);
   ArraySetAsSeries (low,true);

for(int i=0;i<SymbolsTotal(1);i++)
  {  
  int boldef = iBands(SymbolName(i,1), PERIOD_D1,20,0,2,PRICE_CLOSE);
  CopyBuffer(boldef,1,0,3,high);
  CopyBuffer(boldef,0,0,3,mid);
  CopyBuffer(boldef,2,0,3,low);
  double highv=high[0];
  double midv=mid[0];
  double lowv=low[0];
  FileWrite(h,SymbolName(i,1),lowv, midv, highv);
  }
FileClose(h);
}

I did the same script on last year, but i lost all my scripts because that wasn't included to backup! I remember i had the same problem, but i got sucess! But now i'm not reaching the same result. Detail: i'm using that for more than 100 stocks!! 

Even when i try to do that on script and using void OnStart, that script write my file (i can open normally), but the CPU usage still as high as it can!

Can someone help me???