Great EA in backtest! - page 115

 
tururo:
The file is being overwritten every time you open it. One solution is to open the file in the init() function and close it in deinit()

so I did this...

int init()

{

handle=FileOpen("cyberia_log.csv", FILE_CSV|FILE_WRITE, ';');//this is the only place in the code I use FileOpen() I turned all others off.

return(0);

}

int deinit()

{

FileClose(handle);

return(0);

}

and in the code when I want to append something to it I did this...

FileWrite(handle,"SellPossibilityMid:", SellPossibilityMid);

FileWrite(handle,"BuyPossibilityMid:", BuyPossibilityMid);

and I get the error message "too many files open"

 

bool startfileopen = true;

int init()

{

if(startfileopen)

{

handle=FileOpen("cyberia_log.csv", FILE_CSV|FILE_WRITE, ';');

startfileopen = false;

}

this seems to have solved that glitch.

but it still is only showing one entry in the file part of which is truncated...

Order Open Time: ;1160137278

SellPossibilityMid*SellPossibilityQuality:;0.00190286

BuyPossibilityMid*BuyPossibilityQuality:;0.00132571

UndefinedPossibilityMid*UndefinedPossibilityQuality:;0.00365143

UndefinedSucPossibilityQuality:;9

SellSucPossibilityQuality:;9

BuySucPossibilityQuality:;7

UndefinedPossibilityQuality:;18

SellPossibilityQuality:;9

BuyPossibilityQuality:;8

UndefinedSucPossibilityMid:;0.00074444

SellSucPossibilityMid:;0.00082222

BuySucPossibilityMid:;0.0008

UndefinedPossibilityMid:;0.00020286

SellPossibilityMid:;0.00021143

BuyPossibilityMid:;0.00016571

ng Short OrderTicket: ;24; Opened @: ;1.2685; Closed @: ;1.2677; Order Open Time: ;1160121599

 

This might help

Hello Aaragorn great work you are doing on CT, have this E.A. that I think does something kinda similar to what you are doing, maybe there is a way to incorporate this into CT. I think this collects tick data in a csv file somehow.

regards,

mrtools

 

I have a friend who's a programmer who told me to forget the init() deinit() stuff and change when I call it to

handle=FileOpen("cyberia_log.csv", FILE_CSV|FILE_WRITE|FILE_READ,';');

I have to leave this for a bit, I'll check back later. Hopefully dudeworks will get it working. I just don't know how to do this file stuff yet.

 
mrtools:
Hello Aaragorn great work you are doing on CT, have this E.A. that I think does something kinda similar to what you are doing, maybe there is a way to incorporate this into CT. I think this collects tick data in a csv file somehow.

regards,

mrtools

ok THANKYOU! that's interesting, seeing other code that is working helps, I have to leave for a bit but I'll check back.

 

Invalid handle error

Aaragorn, this expert needs an outside source (I think) to either gather the data or distribute it for the E.A. to trade, which unfortunately I don't have and don't have any idea how to create one, so the expert won't trade just gives error message "invalid handle -1 in file read number", just thought the code might help.

regards

mrtools

 
mrtools:
Aaragorn, this expert needs an outside source (I think) to either gather the data or distribute it for the E.A. to trade, which unfortunately I don't have and don't have any idea how to create one, so the expert won't trade just gives error message "invalid handle -1 in file read number", just thought the code might help.

regards

mrtools

Thankyou, I appreciate the encouragement.

as near as I can tell this code first deletes any previous values of the file, then opens a file to add something then closes the file.

then it opens the file to read what it wrote.

the challenge I have is that when I want to add something else to the file without deleting or overwriting what is alredy written in other words appending the new data to the end of the file...

I need an example of how to do that.

 

Can someone teach me how to properly use the file storage and recall functions?

I have looked at this documentation..

int FileOpen( string filename, int mode, int delimiter=';')

Opens file for input and/or output. Returns a file handle for the opened file or -1 (if the function fails). To get the detailed error information, call GetLastError() function.

Notes: Files can only be opened in the terminal_directory\experts\files folder (terminal_directory\tester\files if for expert testing) or in its subfolders.

FILE_BIN and FILE_CSV modes cannot be used simultaneously.

If FILE_WRITE does not combine with FILE_READ, a zero-length file will be opened. If even the file containd some data, they will be deleted. If there is a need to add data to an existing file, it must be opened using combination of FILE_READ | FILE_WRITE.

If FILE_READ does not combine with FILE_WRITE, the file will be opened only if it already exists. If the file does not exist, it can be created using the FILE_WRITE mode.

No more than 32 files can be opened within an executable module simultaneously. Handles of files opened in the same module cannot be passed to other modules (libraries).

Parameters:

filename - Filename.

mode - Opening mode. It can be one or combination of values: FILE_BIN, FILE_CSV, FILE_READ, FILE_WRITE.

delimiter - Delimiter character for csv files. By default, the ';' symbol applies.

Sample:

int handle;

handle=FileOpen("my_data.csv",FILE_CSV|FILE_READ,';');

if(handle<1)

{

Print("File my_data.dat not found, the last error is ", GetLastError());

return(false);

}

I have looked at this but it doesn't go into enough detail to teach how to use it. I suppose if I already knew how to use it this link would make sense but since I don't already know it doesn't give much insight.

http://www.metatrader.info/node/142

 
mrtools:
Aaragorn, this expert needs an outside source (I think) to either gather the data or distribute it for the E.A. to trade, which unfortunately I don't have and don't have any idea how to create one, so the expert won't trade just gives error message "invalid handle -1 in file read number", just thought the code might help.

regards

mrtools

Thankyou for that bit of code. I looked at it and can see it both creating and reading files. I don't see it appending anything on the end of a file it's already created. Maybe it is and I'm just not seeing and maybe it's not doing it and there's nothing to see. I wish I knew a piece of code that we knew WAS appending data to the end so I could see how it does it.

 

CT not working

I have read this thread from front to back trying to find a solution I have the

Cyberia Trader1.85g jpy.mq4 version I have loaded it and have the face but I have not had any orders at all. I am using the USD/CHF pair on 30mins. not having any orders makes it really hard to do any forward testing. the system has been running for 4 days and still no orders.

some help would be great thanks.

cheers

Beno

Reason: