Fileseek current going to beginning of file - page 2

Fernando Carreiro
7040
Fernando Carreiro  
bonechair:

Look I dont understand this so well. I load it up and it returns the correct price on strategy tester running it slowly and that but when I load it on a live trading then I get price from the beginning of the file .hst and Im using

SEEK_CUR And how can it go for beginning. I dont understand these functions. DOUBLE_VALUE is a built in defined for mq4 I think.



It reads like you are actually reading the "History File" (.hst) while live trading. Is that even possible?

Does MT4 actually allow the History File to be read and seeked while it is being updated with new live data?

I thought that, MT4 would lock the file so as not to allow any access to it but maybe I am wrong about that.

Would it not just be easier and faster to read the Bar data ( Open[], Close[], etc. ) directly instead of messing about with the History File?

Personally, I have previously read the data from a history file directly when writing some C++ code to do some stats analysis, but always on an offline copy, never directly with the "live" online version of the file. I did not know that was possible with MT4 running at the same time.

Louis Stoltz
640
Louis Stoltz  

It is possible to read it but I get numbers from beginning of the hst file which is odd when you run it on live. But I guess you right about CURRENT that its maybe not even there in hst file yet because its asking for something thats not recorded yet so that might be why it jumps to different position.

I would like to know how you get the open,close,high and low with these functions because Im not sure how they work yet because it says nothing to me about highs and lows in hst file with fileseek in the books. Its very simply put in the books and I would love more of the examples on their site like on here have comment section with examples https://docs.mql4.com/files/fileseek and related forum discussions.

Ive been working with some of these functions to see if past data will give you correct trades and it works and I have found some months messed up even though it says 90% modelling quality which is upsetting.

Fernando Carreiro
7040
Fernando Carreiro  
bonechair:

It is possible to read it but I get numbers from beginning of the hst file which is odd when you run it on live. But I guess you right about CURRENT that its maybe not even there in hst file yet because its asking for something thats not recorded yet so that might be why it jumps to different position.

I would like to know how you get the open,close,high and low with these functions because Im not sure how they work yet because it says nothing to me about highs and lows in hst file with fileseek in the books. Its very simply put in the books and I would love more of the examples on their site like on here have comment section with examples https://docs.mql4.com/files/fileseek and related forum discussions.

Ive been working with some of these functions to see if past data will give you correct trades and it works and I have found some months messed up even though it says 90% modelling quality which is upsetting.




The History File is a Binary Format holding Time, Open, Low, High, Close and Volume for each Bar in sequential format with the most recent bar being at the end of the file.

I have attached a "C" file template of the format. It is indended for use in "C" programming and not MQL, so you will have to "translate" and adopt for MQL4.

Also use the "period_converter.mq4" script, standard with any MetTrader 4 installation as a reference point into understanding the structure and use of History File.

Files:
histdata.zip  3 kb
Louis Stoltz
640
Louis Stoltz  
Thank you SEEK_CUR only works in strategy tester because the highs and the lows arent written yet on live.
Fernando Carreiro
7040
Fernando Carreiro  
bonechair:
Thank you SEEK_CUR only works in strategy tester because the highs and the lows arent written yet on live.


That is kind of obvious that the last bar of live data is not in the History File. Live Ticks are stored in a separate file.

I had already stated that, that it cannot be used in Live Real-Time, only on back-testing.