| / | Forum |
|
|
|
MetaTrader 5 - More Than You Can Imagine! The MetaTrader 5 client terminal has been developed from scratch and far surpasses its predecessor, of course. The new trading platform provides unlimited opportunities for trading in any financial markets. Moreover, its functionality keeps expanding to offer even more useful features and convenience. So now it is now quite difficult to list all numerous advantages of MetaTrader 5. We have tried to briefly describe them in one article, and we got surprised with the result - the article is far from brief! |
|
|
|
|
qjol: try FileOpen("myLog.txt", FILE_BIN|FILE_READ|FILE_WRITE); FileOpen("myLog.txt", FILE_CSV|FILE_READ|FILE_WRITE); You are not writing a BINARY file. You want a txt file. There is no need to keep opening and closing the file. That is very slow and you will need to do a FileSeek to the end of the file each time. Just open it once, and use FileFlush every now and then. > it does not seem to be working for me is not a very helpful fault report. This is what you would expect from a user, not from a programmer. If you can state the problem accurately it helps to find the solution :-) |
|
|
Hi Thanks for your replies, but i just want to write the below information to a text file for now, I am just working with some logging before I start planning out my EA. So for example the output i require is : [Date] 12:24:53 The current bid is 1.33981 [Date] 12:24:57 The current bid is 1.33997 Once I get this output, i can move on to phase 2 for my EA. Can you please assist. |
|
|
Blackberry: Thanks for your replies, but i just want to write the below information to a text file for now, I am just working with some logging before I start planning out my EA. Your code, in its current form, is going to log the latest price, constantly overwriting what was already in myLog.txt, and leaving only the most recent entry. |
|
|
Hi Guys I would like to thank everybody above in helping me obtain the information I needed. JJC i will be more clearly in my posts next time and thank you for your help. I would just like to post the working method here so others can change it around and use it as they wish. My next step is to make this method more dynamic. But for now I have the info I want in the file. PS can somebody please mark this thread as completed. Thanks again void LogOperations() { int handle; string str = TimeToStr(TimeCurrent()) + " The current Bid is " + Bid + "\r\n"; handle=FileOpen("myLog.txt", FILE_BIN|FILE_READ|FILE_WRITE); if(handle<1) { Print("can't open file error-",GetLastError()); return(0); } FileSeek(handle, 0, SEEK_END); FileWriteString(handle, str, StringLen(str)); FileClose(handle); } |
Hi guys
I thought it would be quite simple to achieve this but, it does not seem to be working for me.
I am trying to create my own log file so for example I want to write the current bid for every tick to a txt file.
The output i require is :
[Date] 12:24:53 The current bid is 1.33981
[Date] 12:24:57 The current bid is 1.33997
Thats all I require, heres the code I came up with but it doesnt work.