The problem is, why the FileWrite function removes the first two characters from the second cell?
Your code, which we cannot see, is broken.
n | o | n | e | n | o | n | e |
A | U | D | C | H | F | n | e |
you are overwriting your existing data . . .
Thank you RaptorUK for your fast respond.
I’m testing with this code:
handle=FileOpen("AlertPairsFile.csv", FILE_CSV|FILE_READ|FILE_WRITE, ';'); if(handle>0) { FileWrite(handle,"AUDCHF"); FileFlush(handle); FileClose(handle); }
If I put the text "AUDC" in the FileWrite above then it works great and will not remove from the next line. So do I need to put only 4 characters in the FileWrite in order for the code to work fine?
Thank you RaptorUK for your fast respond.
I’m testing with this code:
If I put the text "AUDC" in the FileWrite above then it works great and will not remove from the next line. So do I need to put only 4 characters in the FileWrite in order for the code to work fine?
If you want to add to the end of the file you first need to seek to the end of the file . . .
FileSeek(handle, 0, SEEK_END);
. . . I've not done it but I assume if you want to add to the start of the file you will need to make room by moving the other contents along in the file.
I did try the Seek End before, it works great.
But here I have another situation.
I have another function that open the CSV file, then search for a cell with some value and replace it with the current symbol of the chart, so I don’t want the FileWrite to remove anything from the next cell.
I guess I will use only the first 4 characters from the symbol. I also tried to write to the file “audchf” instead of “AUDCHF” but the same results.
I did try the Seek End before, it works great.
But here I have another situation.
I have another function that open the CSV file, then search for a cell with some value and replace it with the current symbol of the chart, so I don’t want the FileWrite to remove anything from the next cell.
I guess I will use only the first 4 characters from the symbol. I also tried to write to the file “audchf” instead of “AUDCHF” but the same results.
Thank you RaptorUK
you gave me breakthrough.
Thanks

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I have a problem writing to a file.
These are the two first cells in the CSV file:
none
none
After running this line:
FileWrite(handle,"AUDCHF");
The result is :
AUDCHF
ne
The problem is, why the FileWrite function removes the first two characters from the second cell?
Thanks