Hi all:
Im using filewrite function for first time and its working well but the output it gives into the csv file is not double values nor text, more specifically, I will get the value of the pair without comma separator (ie if its 1,323 it will go 1323) but the worst part is that if there are zeros on the right of it, they wont go to the output!!
ie: (1,3230 will go 1323 while 1,2384 will still go 12384) so I have no even way of treating the data.
Is there an easy way to make the output be double values?? Thank you!
Here is the function as I am using it now:
int handle;
handle=FileOpen("LastCandleReport.csv", FILE_CSV|FILE_WRITE, ';');
FileWrite(handle, iOpen(,PERIOD_H4,1),iHigh(EURUSD,PERIOD_H4,1), iLow(EURUSD,PERIOD_H4,1), iClose(EURUSD,PERIOD_H4,1));
This is wrong . . .
iOpen( , PERIOD_H4,1)
. . . doubles are converted to strings so any trailing zeros will be removed.
From the documentation: "Data of int and double types are automatically converted into a string, but those of color, datetime and bool typesare not automatically converted and will be written to file as they are (as integers)."
Use SRC button to post the code
Well you call it comma as decimal mark, most of us here call it dot. So instead 1,2345 with comma between 1 and 2, it's 1.2345 its dot between 1 and 2 ;D. click here for Wikipedia article on decimal marks
Anyway, read again the documentation about iOpen, iClose, IHigh, iLow . The first parameter of them is a string, so you should use string then.
iClose(EURUSD,PERIOD_H4,1); ==>> wrong iClose("EURUSD",PERIOD_H4,1); ==>> correct
Use SRC button to post the code
Well you call it comma as decimal mark, most of us here call it dot. So instead 1,2345 with comma between 1 and 2, it's 1.2345 its dot between 1 and 2 ;D. click here for Wikipedia article on decimal marks
Anyway, read again the documentation about iOpen, iClose, IHigh, iLow . The first parameter of them is a string, so you should use string then.
Unless . . .
string EURUSD = "EURUSD";
;-)
Hey guys I appreciate your help but you are focusing on other things than the problem!
Its true I didnt copy the correct spelling you are right hehe but real problem is when exporting the data to the CSV file as a string:
DoubleToStr(iClose("EURUSD",PERIOD_H4,1),5);
It wont use a delimiter (be it coma or dot, as you can see in Wikipedia article Spain uses coma as decimal mark, and Im spanish hehe), so the real quiz is:
Can I make filewrite easily export the values to CSV using decimal mark?
If not, what im going to do to work around is define each value number of not decimals (ie checking if value <0.1, value<1, value<10, value<100, etc) and attach it to the value exports and then put the decimal delimitor back through excel spreadsheet).
Thank you guys!
Hey guys I appreciate your help but you are focusing on other things than the problem!
Its true I didnt copy the correct spelling you are right hehe but real problem is when exporting the data to the CSV file as a string:
DoubleToStr(iClose("EURUSD",PERIOD_H4,1),5);
It wont use a delimiter (be it coma or dot, as you can see in Wikipedia article Spain uses coma as decimal mark, and Im spanish hehe), so the real quiz is:
Can I make filewrite easily export the values to CSV using decimal mark?
If not, what im going to do to work around is define each value number of not decimals (ie checking if value <0.1, value<1, value<10, value<100, etc) and attach it to the value exports and then put the decimal delimitor back through excel spreadsheet).
Thank you guys!
This is what your corrected code produces . . .
1.29048;1.29513;1.28913;1.29391
if you want a delimiter other than ; then set it to what you want in the FileOpen() call
1. Open the csv with notepad/text document.
2. Let's see the csv. Attach your csv here.
-_- Again you were right, I had to change the OS decimal delimiter and problem solved :)
http://blogmines.com/blog/2010/03/11/how-to-change-the-decimal-separator-in-excel-2010/
Thank you guys!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all:
Im using filewrite function for first time and its working well but the output it gives into the csv file is not double values nor text, more specifically, I will get the value of the pair without comma separator (ie if its 1,323 it will go 1323) but the worst part is that if there are zeros on the right of it, they wont go to the output!!
ie: (1,3230 will go 1323 while 1,2384 will still go 12384) so I have no even way of treating the data.
Is there an easy way to make the output be double values?? Thank you!
Here is the function as I am using it now:
int handle;
handle=FileOpen("LastCandleReport.csv", FILE_CSV|FILE_WRITE, ';');
FileWrite(handle, iOpen(,PERIOD_H4,1),iHigh(EURUSD,PERIOD_H4,1), iLow(EURUSD,PERIOD_H4,1), iClose(EURUSD,PERIOD_H4,1));