FileOpen error 4103 during simulation

[Deleted]  

I have a problem opening a CSV file, the error only occurs when I run the EA in simulation mode. The file contains settings for the system that needs to be traded, since it's a large amount of numbers I've decided to put it in a file, rather than as variables in the EA.


I also tried a workaround so that only the indicators would use these settings (i hardcoded some values into the EA) but then i get the error that the indicator can't open file.


Is there a restriction on opening files when the EA is running in simulation?

[Deleted]  

Files can be written and read during strategy tester runs.

Need to know a bit more about what you're doing to be able to work out what is happening during backtests.


CB

[Deleted]  

I can't post the whole code because it's proprietary, but I hope this snippet can provide more answers:


   string filename = "Config_"+Symbol()+Period()+".csv";
   int fp = FileOpen( filename, FILE_CSV | FILE_READ );

   if ( fp < 1 )return ( Error( "EA: Cannot open file "+filename+" error #"+GetLastError() ) );

I'm running this on EURUSD, 1H chart. The file Config_EURUSD60.csv exists. If i load this expert advisor into a live window, it gives me a smiley face and also outputs all the summary of the configuration (I made it output it, so I can check if it has all the right data). But when I run this in a simulation, under journal I get the message: EA: Cannot open file Config_EURUSD60.csv error #4103


This code gets run in the init().



P.S.: Thank you for the quick reply :)

 
is a copy of the file in the folder tester/files/ ? it needs to be there for testing
[Deleted]  

Ah, thank you! The file was in experts/files/ ... I didn't know that for testing it needs to be in the special directory.


Thank you!

[Deleted]  

Was going to mention that in the original response but just ASSUMED you'd be creating the file in the backtest as well as reading from it.


CB