For more context, I'll add the declarations of the variables used.
CArrrayLong m_basket; bool m_tester; bool m_optimization;
An example of the return value from the GenerateFileName function - "Prefix_EURUSD_9061_0.bin"
For more context, I'll add the declarations of the variables used.
An example of the return value from the GenerateFileName function - "Prefix_EURUSD_9061_0.bin"
Are you sure the file is not accidentally being deleted with this?
if(m_basket.Total() == 0) { if(FileIsExist(name)) FileDelete(name); }
I would suggest instead of deleting, rename to a unique filename
That will reveal if this is this the case
Are you sure the file is not accidentally being deleted with this?
I would suggest instead of deleting, rename to a unique filename
That will reveal if this is this the case
Thanks, that's an excellent suggestion.
Although the file was not deleted from this line. I found there was a different section of the code that would delete the file once it was created.
Thanks, that's an excellent suggestion.
Although the file was not deleted from this line. I found there was a different section of the code that would delete the file once it was created.
I'm not yet as good at programming as some people here, but to avoid this type of error I try to create prints almost everywhere,
if(FileIsExist(name)) { FileDelete(name); Print("Somethink"); }
I'm not yet as good at programming as some people here, but to avoid this type of error I try to create prints almost everywhere,
Yes, works very well.
To make the prints more manageable, I'll recommend encasing them in an if statement.
bool debug = true; //global variable void CSomeClass::SomeFunction() { if(FileIsExist(name)) { FileDelete(name); if(debug) printf(__FUNCTION__" file %s deleted",name); } }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have this code for saving tickets that are stored in an object of the CArrayLong class
If I run the code in debug mode, it works perfectly and the file is saved. However, if I run it live, I still see the message "Saved successfully ..." and even though there are no errors, the file is not created in the system.
When compiling the program, I have tried using "No optimizations" and it has no effect. Am I missing something or is this an MQL5 bug?