- You defined Max_Value as global variable so it is globally accessible.
- for is not a function, so variable that are not defined within the loop 'keep' their value after the loop has ended
- Your code snippet will not return a max. value but only the last value - think about using fmax() or MathMax()?
- It would be better to initialize Max_Value for fmax(). In your case the variable is automatically init. by 0 but in other cases it has a random value!
int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } int start() ...
Start using the new Event Handling Functions Or the old ones. Not both.- Carl Schreiber: It would be better to initialize Max_Value for fmax(). In your case the variable is automatically init. by 0 but in other cases it has a random value!Not using strict it will be zero only the first time your code runs. Code breaks after that. Other comments are also valid.
for(i = 0; i<1000; i++)
Are you sure you have a thousand lines in the file? Make it an infinite loop and stop when you've exhausted the file.data_double_datetime[i]= FileReadString(file_handle,1); data_double_average[i]= FileReadString(file_handle,2);
Your timestamp is only one character? Your double is only two? why are you reading a string when you know it's a double?- Don't double post
- Stop Triple posting!
- Start using the new Event Handling Functions Or the old ones. Not both.
- Not using strict it will be zero only the first time your code runs. Code breaks after that. Other comments are also valid.
- Are you sure you have a thousand lines in the file? Make it an infinite loop and stop when you've exhausted the file.
- Your timestamp is only one character? Your double is only two? why are you reading a string when you know it's a double?
- Where do you ever open the file?
The OP obviously has very little knowledge about programming. Instead of such extensive answer and all these links, I would suggest you to create a new topic, for example, "FAQ about mql4 programming" (name doesn't matter of course) or something like that. With all your remarks and links, using anchors. So you will be able to provide 1 link related to the OP topic and at the same time the OP will have access to all information if he wants. In case you do it, please don't use html table.
By the way you didn't answer the OP question.
- Makes no sense when the OP has at least four separate problems.
- What table? I haven't use a table since I read your first mention of the problem yesterday.
- Makes no sense when the OP has at least four separate problems.
- What table? I haven't use a table since I read your first mention of the problem yesterday.
I am talking in general about your posts, taking this one as example. Sorry mentioning table, I was preparing this post before you stopped to use them and didn't had time to post it.
I agree. Almost all of whroeder1's forum replies are barely readable on mobile.
For the Nth time. I have not posted a single post with tables for over 28 hours. Since the first mention of a problem. How many times do you people have to repeat it????
![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
How do I use the Max Value value outside of function "for"?