Download MetaTrader 5
To add comments, please log in or register
Start making profit using the Market. Publish your product!
Luis
226
Luis 2014.12.03 18:29 

Whenever the file.csv Im using in script is being used by windows the system "freeze". What should I do?


//+------------------------------------------------------------------+
//|                                       Open_my_Charts.mq4     
//
//|    BeLikewater(forexfactory.com) email= nitx20@hotmail.com  | 
//+------------------------------------------------------------------+
#property copyright "Freeware"
#property strict
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   //Close all the charts except the first one
   while (ChartNext(ChartFirst())!=-1) 
   ChartClose(ChartFirst());
   
   

   
   int handle=FileOpen("OpenCharts.csv",FILE_SHARE_READ);  
   
   string simbolo,plantilla;
   long chart_num;
   int contador=0;
   
   //Read the first row
   FileReadString(handle);
   while(FileIsLineEnding(handle)!=TRUE)FileReadString(handle);
   
   //Open Charts
   while(!FileIsEnding(handle))
      {
      if(FileIsLineEnding(handle)==TRUE)contador=0;
      contador++;
      if (contador==1)simbolo=FileReadString(handle);
      if (contador==2)chart_num=ChartOpen(simbolo,StrToInteger(FileReadString(handle)));
      if (contador==3)ChartApplyTemplate(chart_num,FileReadString(handle));
      }  
      
   ChartClose(ChartFirst());
   FileClose(handle);
  }
//+------------------------------------------------------------------+  
Carl Schreiber
5962
Carl Schreiber 2014.12.03 20:21  

I have (had?) a similar problem with LO: A csv-file opened by LO could not be (shared-) read by a (kernell32.dll-) Windows-function - the csv-file is blocked.

But I was told that LO-version 4.3 offers save copy which should not cause the problem.

/
To add comments, please log in or register