How to set program to save chart's data? - page 3

 
RaptorUK:
Nope, I'm not in the coding for cash business . . . . I spend my time here trying to help. . . . and refusing to provide information that would help those that try to help you.
RaptorUK:
No. DIY.


I think you should forget it, you seem lack of experience on understanding user, Maybe another guy would coach you on this.

If you have any suggestions on your solution and show your coding, you are welcome, else it will be the end of the post.

Thanks everyone very much for any suggestions

 

The count was a device to put extra blank lines into the csv to split the data up into monthly or some such grouping. Remove the suicide and alert and have it run for every new bar on a 15M chart. The problem is that this is set up as a one grab of data so the opening of the file name and the grab happens once in the program initialiation. The file handling and writing the data needs to be altered for your purpose. the codebase program can be altered to save barinfo every 15M much more easily. A combination of getting all the bars once and then seeking the end of the file and using the codebase sugested should do the job.

 

Referring to your coding as shown below, I would like to save csv file into C:\file\AUDUSD30.csv.

I am a beginner in MT4, and try to learn coding at the first time with programming background, if you can show me how to change the coding for file handling and writing the data needs, it will be a great help, furthermore, I get no idea on how to set the codebase program to save barinfo every 15 M,

Could you please give me any suggestions? and show me the coding on how to handle this situation.

Thanks everyone very much for any suggestions

Ickyrus:

//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
int handle ;
double count=0 ;
handle=FileOpen(ToFileName,FILE_CSV|FILE_WRITE,",");
int LineCount = 0 ;
if ( handle>0 )
{
FileWrite(handle, "Date","Time","OPEN","HIGH","LOW","CLOSE",Bars);
for(int i=0;i<Bars;i++)
{
FileWrite(handle, Date2String(Time[i]),Date2Time(Time[i]),Open[i],High[i], Low[i],Close[i]);
count=count+1
}//for
}//if
FileClose(handle);
//----
return(0);
}

string Date2String( datetime MyTime)
{
int TheDay = TimeDay( MyTime ) ;
int TheMonth = TimeMonth( MyTime ) ;
int TheYear = TimeYear( MyTime ) ;

return( TheDay+"/"+TheMonth+"/"+TheYear ) ;
}
///////////////
string Date2Time( datetime MyTime)
{
int TheHour = TimeHour( MyTime ) ;
int TheMinute = TimeMinute( MyTime ) ;
int TheSeconds = TimeSeconds( MyTime ) ;

return( TheHour+":"+TheMinute+":"+TheSeconds ) ;
}

 
I really have no desire to be the do it for you guy sorry.
 
Ickyrus:
I really have no desire to be the do it for you guy sorry.


No problem, thank you very much for your suggestions.

This is my first time to learn MT4 coding, I need to look at more samples to learn this language.

Does anyone have any suggestions?

Thanks everyone very much for any suggestions

Reason: