Try to insert code properly.
MQL5.community - User Memo
- 2010.02.25
- MetaQuotes Software Corp.
- www.mql5.com
You have just registered and most likely you have questions such as, "How do I insert a picture to my a message?" "How do I format my MQL5 source code?" "Where are my personal messages kept?" You may have many other questions. In this article, we have prepared some hands-on tips that will help you get accustomed in MQL5.community and take full advantage of its available features.
int OnInit(){ int filePtr = FileOpen("FileOutput.txt", FILE_CVS|FILE_WRITE); FileWrite(filePtr, 1, 2, 3); FileClose(filePtr); return 0; }
Hope that's clearer.
Steven
Sorry, just realised that the file will is opened in a different folder, under the tester folders. Sorry about that. That should help me figure out my other problem.
Steven
I did the same thing and I can't find the file.
int OnInit() { if (DealHandlerDevice.IsSetup()==false) DealHandlerDevice.Setup(); CreateInitialPyramid(Symbol()); filehandle=FileOpen("drawdowns.txt",FILE_COMMON||FILE_ANSI||FILE_WRITE); return(0); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { double p=GlobalPips(); p=GlobalPips(); if (p<drawdown) drawdown=p; if (p>=Target) { FileWrite(filehandle,drawdown); //Print("Profit ",p," > target ",Target); CloseAll(); CreateInitialPyramid(Symbol()); drawdown=9999999999.99; } } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { FileClose(filehandle); }
If the backtest is stopped before end, files are not written?
TheEconomist:
Also (offtopic) : Why, if backtest is stopped before end, there is no Results tab?
We don't know the reason of interrupt. Therefore, agent should be stopped immediately and quickly
Also (offtopic) : Why, if backtest is stopped before end, there is no Results tab?
No, I meant, If I stop it by clicking on Stop, I should see the Results tab containing what was done until that moment.
File issue solved: it cannot make the file if operators are || . Must be only bitwise ( | ).
TheEconomist:
No, I meant, If I stop it by clicking on Stop, I should see the Results tab containing what was done until that moment.
No, I meant, If I stop it by clicking on Stop, I should see the Results tab containing what was done until that moment.
We'll think about it.
Could you please write your suggestion to ServiceDesk
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Not sure if this is a bug, or if I'm just trying to do something that is not possible. Below is a very simple EA code, to run on the tester to see if I can use the file output.
int OnInit(){
int filePtr = FileOpen("FileOutput.txt", FILE_CVS|FILE_WRITE);
FileWrite(filePtr, 1, 2, 3);
FileClose(filePtr);
return 0;
}
When run in a demo account, this works fine, but when I run it in the tester, the file is not even produced. Is file I/O even possible when using the tester?
Regards,
Steven