//--- display the window of input parameters when launching the script#property script_show_inputs//--- input parametersinputstring InpFileName="data.bin";
inputstring InpDirectoryName="SomeFolder";
//+------------------------------------------------------------------+//| Structure for storing price data |//+------------------------------------------------------------------+struct prices
{
datetime date; // datedouble bid; // bid pricedouble ask; // ask price
};
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//--- structure array
prices arr[];
//--- file pathstring path=InpDirectoryName+"//"+InpFileName;
//--- open the fileResetLastError();
int file_handle=FileOpen(path,FILE_READ|FILE_BIN);
if(file_handle!=INVALID_HANDLE)
{
//--- read all data from the file to the arrayFileReadArray(file_handle,arr);
//--- receive the array sizeint size=ArraySize(arr);
//--- print data from the arrayfor(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 fileFileClose(file_handle);
Comment( arr[i].bid + " bid " );
}
elsePrint("File open failed, error ",GetLastError());
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
hi my friend
i want to use
FileIsLineEndingwith
to read last line in txt to comment
please