Working with Excel (tools, indicators, conversion ...) - page 3

 

There is some thread https://www.mql5.com/en/forum/172929

If not try to look at the whole section https://www.mql5.com/en/forum

 

well it is for converting a hst to csv or something like that

the thing i was looking for is simple converting a day data into week or month

(in excel) as i have the data in excel

 

Help: Simple Save Data To A File

I'm tinkering around trying to figure out how to send 15 minute data to a file. Any help would be appreciated.

It compiles without errors. I put it in the Indicator folder and it's visible, but when I try to add it in MT4, it's not accepted - does not get added to the EURUSD chart.

int start()

{

int handle;

string tSymbol="EURUSD";

double rates_m15[][6];

ArrayCopyRates(rates_m15,tSymbol,PERIOD_M15);

handle=FileOpen("Out.csv",FILE_CSV|FILE_WRITE,',');

if (handle<1)

{

Print("File Out.CSV not found, the last error is ", GetLastError());

return(false);

}

else

{

FileWrite(handle,tSymbol,TimeToStr(rates_m15[0][0]),rates_m15[0][1],rates_m15[0][2],rates_m15[0][3],rates_m15[0,4]);

FileClose(handle);

Alert("Sent Data File");

}

}

 

Array Issue?

I'm just taking a wild stab here, but I thought that MT4 could only handle single element arrays. I thought I read that somewhere.

Also FYI, the compiler is not bullet proof. It seems to compile even though there may be issues in the code, i.e. datetime variables accidently declared as int.

Try the Metaquotes (manufacturer's) forum for researching the big bugs.

 

I have 2 scripts that I wrote. the 1st one will write to the history, up to the datetime you can change. The 2nd will write to a CVS file. Hope it will help you

Eli

Files:
 

Hi, sorry for asking this, maybe I'm just not quite understand the problem. But why need additional script to write to CVS file when we already have SAVE AS feature from MT4 ? Thank you in advance

 
firedave:
Hi, sorry for asking this, maybe I'm just not quite understand the problem. But why need additional script to write to CVS file when we already have SAVE AS feature from MT4 ? Thank you in advance

CVS files is great way to see the data in Excel. Not always, u want to see only the OCLH values. I use this script to save the MA or MACD values and analyze them afterwards.

 
elihayun:
CVS files is great way to see the data in Excel. Not always, u want to see only the OCLH values. I use this script to save the MA or MACD values and analyze them afterwards.

Understand, thank you for the reply

 

Did it

This did the trick. Thanks a lot.

I'm a better VB6 than 'C' programmer, so while I'm re-going through the learning curve (haven't programmed in 'C' since the mid-80s when I worked on Unix), I'm interacting between MT4 & VB6. I'm programming in the MMTS system from the e-Book - which I can do easily in VB6 with the interaction from MT4. I can also use a number of visual metaphors such as scoring the 19 different setups identified by Monika.

I know that I can use the DDE connection between MT4 & VB6, but this lets me leverage the MT4 system.

Thanks again.

 

Figured out problem

With the help of the other posts, I figured out the problem. I'm sure anyone looking at it knew and were just letting me struggle so I'd learn from it :-)

1) I didn't understand the difference between a script and an indicator. That's why MT4 wouldn't accept it.

2) I left out the "return(0)" at the end of the start() section.

MarkC.