Download MetaTrader 5
To add comments, please log in or register
Write articles, help other developers and make money
Louis Stoltz
636
Louis Stoltz 2013.12.26 07:54 


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
17994
Simon Gniadkowski 2013.12.26 10:25  
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()
Ovo Cz
3049
Ovo Cz 2013.12.26 12:58  
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
17994
Simon Gniadkowski 2013.12.26 13:15  
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.
Ovo Cz
3049
Ovo Cz 2013.12.26 13:28  
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
17994
Simon Gniadkowski 2013.12.26 13:36  
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 2013.12.28 10:41  

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
17994
Simon Gniadkowski 2013.12.28 12:12  
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
14239
whroeder1 2013.12.28 13:41  
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 2013.12.29 07:10  

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
17994
Simon Gniadkowski 2013.12.29 10:33  
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