This is a great idea, unfortunately, I can't get it to do anything! Maybe something wrong with the code or with the way I installed it, but its not creating any .csv files anywhere on my pc.
Hi komposter,
Thanks for your TickSave code. It appears to work fine under Windows XP, but not under Vista. There, I think it would need some rights to create the directories and files. Could you adapt the code for Vista?
Also, I would like to have some volume information. However, I think MT4 does not provide volumes at the tick level. Is this correct? Is there a way around, perhaps?
Thank you & regards,
Andrei
Unfortunately depending on currency you put this EA on it has potential to loose lots of ticks of other currencies. I solved that problem by putting my EA on each currency I want to record, it gives much more reliable recording.
//+------------------------------------------------------------------+ //| Tick_recorder_v2.mq4 | //| | //| | //+------------------------------------------------------------------+ #property copyright "Jake" #property link "" #property show_inputs extern string realfolder="real"; extern string testfolder="test"; int fh; datetime lasttime; double volume,lastvolume; //+------------------------------------------------------------------+ //| expert initialization function | //+------------------------------------------------------------------+ int init() { //---- if(StringLen(StringTrimRight(realfolder))==0)realfolder="real"; if(StringLen(StringTrimRight(testfolder))==0)testfolder="test"; lasttime=StrToTime(TimeYear(TimeCurrent()-DayOfWeek()*60*60*24)+"."+TimeMonth(TimeCurrent()-DayOfWeek()*60*60*24)+"."+TimeDay(TimeCurrent()-DayOfWeek()*60*60*24)); if(IsTesting()) { fh=FileOpen(file_name()+"_ticks.tic",FILE_WRITE|FILE_BIN); FileClose(fh); } fh=FileOpen(file_name()+"_ticks.tic",FILE_WRITE|FILE_READ|FILE_BIN); if(fh==-1) {Print("cannot open file");return(-1);} bool b=FileSeek(fh,0,SEEK_END); lastvolume=Volume[0]; //---- return(0); } //+------------------------------------------------------------------+ //| expert deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- FileFlush(fh); FileClose(fh); //---- return(0); } //+------------------------------------------------------------------+ //| expert start function | //+------------------------------------------------------------------+ int start() { if(fh==-1) {Print("no file");return(-1);} datetime currenttime=StrToTime(TimeYear(TimeCurrent()-DayOfWeek()*60*60*24)+"."+TimeMonth(TimeCurrent()-DayOfWeek()*60*60*24) +"."+TimeDay(TimeCurrent()-DayOfWeek()*60*60*24)); if(lasttime<currenttime) { lasttime=currenttime; FileFlush(fh); FileClose(fh); if(IsTesting()) { fh=FileOpen(file_name()+"_ticks.tic",FILE_WRITE|FILE_BIN); FileClose(fh); } fh=FileOpen(file_name()+"_ticks.tic",FILE_WRITE|FILE_READ|FILE_BIN); } //---- if(lastvolume>Volume[0]) { lastvolume=Volume[0]; volume=Volume[0]; } else { volume=Volume[0]-lastvolume; lastvolume=Volume[0]; } if(volume==0)volume=1; int k=FileWriteInteger(fh,TimeCurrent()); int l=FileWriteDouble(fh,Bid); int m=FileWriteDouble(fh,Ask); int n=FileWriteDouble(fh,volume); //---- return(0); } string file_name() { int day1,month1; string year=TimeYear(lasttime); month1=TimeMonth(lasttime); if(month1<10)string month="0"+month1; else month=month1; day1=TimeDay(lasttime); if(day1<10)string day="0"+day1; else day=day1; string filename=(Symbol()+StringTrimRight("\\ ")+year+StringTrimRight("\\ ")+Symbol()+year+month+day); if(IsTesting()) { filename=StringTrimRight(testfolder+"\\ ")+filename; } else { filename=StringTrimRight(realfolder+"\\ ")+filename; } return(filename); } //+------------------------------------------------------------------+
thk for share,.but why it only works on the symbol EURUSD, and it does not work on another chart?

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Tick Collector 'TickSave':
Author: Andrey Khatimlianskii