Download MetaTrader 5
To add comments, please log in or register
Find out how to add a video in the messages editor
ayoublaser
99
ayoublaser 2015.06.16 20:41 

hi my friend

i want to use

FileIsLineEnding

with

//--- display the window of input parameters when launching the script
#property script_show_inputs
//--- input parameters
input string InpFileName="data.bin";
input string InpDirectoryName="SomeFolder";
//+------------------------------------------------------------------+
//| Structure for storing price data                                 |
//+------------------------------------------------------------------+
struct prices
  {
   datetime          date; // date
   double            bid;  // bid price
   double            ask;  // ask price
  };
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//--- structure array
   prices arr[];
//--- file path
   string path=InpDirectoryName+"//"+InpFileName;
//--- open the file
   ResetLastError();
   int file_handle=FileOpen(path,FILE_READ|FILE_BIN);
   if(file_handle!=INVALID_HANDLE)
     {
      //--- read all data from the file to the array
      FileReadArray(file_handle,arr);
      //--- receive the array size
      int size=ArraySize(arr);
      //--- print data from the array
      for(int i=0;i<size;i++)
         Print("Date = ",arr[i].date," Bid = ",arr[i].bid," Ask = ",arr[i].ask);
      Print("Total data = ",size);
      //--- close the file
      FileClose(file_handle);
Comment( arr[i].bid + " bid " );
      }
   else
      Print("File open failed, error ",GetLastError());
  }

to read last line in txt to comment

please

whroeder1
13596
whroeder1 2015.06.17 00:43  
int file_handle=FileOpen(path,FILE_READ|FILE_BIN);
You are reading a binary files, there are no lines, there are no line endings.
ayoublaser
99
ayoublaser 2015.06.17 10:52  

how can i do this if outher way help me


it get a totale data=0

and error 5004

why

/
To add comments, please log in or register