copying a number from a text document
- Trade muliple currency Pairs
- Find number of lines in a CSV file
- How to know how many candles there are between two points?
- If there are a reasonable number of lines (under millions) you can read each line and add to an array and you can access any element.
- Otherwise, just remember the last two.
int last, prev; ⋮ while(…){ prev = last; last = FileReadNumber(h); }
- Or the last n:
int iLast=0, array[]; ArrayResize(array,n); ⋮ while(…) array[--last % n] = FileReadNumber(h); #define prev(i) array[ (last+i) % n ] // last=prev(0)
- If there are a reasonable number of lines (under millions) you can read each line and add to an array and you can access any element.
- Otherwise, just remember the last two.
- Or the last n:
ok. Now I am just trying to read all the numbers( 1660 numbers) from a csv file and print. But it only printing the last 205 numbers only. what is wrong with me?
//+------------------------------------------------------------------+ //| test1.mq4 | //| Copyright 2020, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2020, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" //#property strict #property script_show_inputs //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ void OnStart() { int FH=FileOpen("file.csv",FILE_CSV|FILE_WRITE|FILE_READ|FILE_SHARE_READ); while(!FileIsEnding(FH)) { double num =FileReadNumber(FH); PrintFormat(num); } FileClose(FH); } //+------------------------------------------------------------------+
ok. Now I am just trying to read all the numbers( 1660 numbers) from a csv file and print. But it only printing the last 205 numbers only. what is wrong with me?
Please ignore the above post. When I opened log file, all numbers are there. Don't know why most of the numbers are not showing in the experts tab!!.
Anyway thanks for your help friend....
Check the log for the prints, not just the tab.