Download MetaTrader 5

Fileseek current going to beginning of file

To add comments, please log in or register
Louis Stoltz
636
Louis Stoltz  


I open a file with handle right then this happens

FileSeek(handle, DOUBLE_VALUE, SEEK_CUR);

Price = FileReadDouble(handle);

The Price that I get here on backtesting is correct but once I go and test it on live trading the filereadDouble returns a number from the beginning of the file and not the SEEK_CUR

Anybody ever had this problem?

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
bonechair:


I open a file with handle right then this happens

FileSeek(handle, DOUBLE_VALUE, SEEK_CUR);

Price = FileReadDouble(handle);

The Price that I get here on backtesting is correct but once I go and test it on live trading the filereadDouble returns a number from the beginning of the file and not the SEEK_CUR

Anybody ever had this problem?

How can you seek to a position in your file based on a double value ? how do you get to a position based on a fraction of a byte ? Please read the documentation --> FileSeek()
Ex Ovo Omnia
3188
Ex Ovo Omnia  
RaptorUK:
How can you seek to a position in your file based on a double value ? how do you get to a position based on a fraction of a byte ? Please read the documentation --> FileSeek()

I think you should correct your post, Raptor. There is no double in his code. He skips 8 bytes.
Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
Ovo:
I think you should correct your post, Raptor. There is no double in his code. He skips 8 bytes.
Ah I see, DOUBLE_VALUE is a constant . . . can't see it defined anywhere but MetaEditor knows it.
Ex Ovo Omnia
3188
Ex Ovo Omnia  
RaptorUK:
Ah I see, DOUBLE_VALUE is a constant . . . can't see it defined anywhere but MetaEditor knows it.

I am not surprised, as there are so many garbage posts here, that a serious question remains undetected :)

But OP should supply a code for reproducing the issue, I never had trouble with setting the file pointers.

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
Ovo:

I am not surprised, as there are so many garbage posts here, that a serious question remains undetected :)

But OP should supply a code for reproducing the issue, I never had trouble with setting the file pointers.

Indeed, and yes, code to reproduce the issue helps either confirm it as a bug or produces and answer quicker.
Louis Stoltz
636
Louis Stoltz  

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.

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
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 might help others help you if you post your code . . . please use the SRC button to do so.
whroeder1
14781
whroeder1  
bonechair: DOUBLE_VALUE is a built in defined for mq4 I think.
You THINK? You also THINK that it is defined as 8? FileWriteDouble - MQL4 Documentation
size - Optional format flag. It can be any of the following values:
DOUBLE_VALUE (8 bytes, default)
FLOAT_VALUE (4 bytes).

It's an enumeration. It's VALUE could be anything.

Why are you trying to skip a single double? Why don't you just read it and ignore it?

Louis Stoltz
636
Louis Stoltz  

Ive got this code from a Russian coder but Im new to fileseek and filewrite and want to know how it works. So Im not sure about double_value but the point is that strategy tester spits out current value but that darn

live trading spitting out begginging of file current values. When you live maybe its not saved as a row and you cant do seek_cur or what? What does seek_cur get there, the open price or what, I dont understand precision number with floating point?

Simon Gniadkowski
Moderator
18003
Simon Gniadkowski  
RaptorUK:
It might help others help you if you post your code . . . please use the SRC button to do so.


Show your code if you want specific help . . .
12
To add comments, please log in or register