Questions from Beginners MQL4 MT4 MetaTrader 4 - page 154
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
The first thing that catches your eye is that you are using the EA as an ordinary script. Read the manual to see how they are different. It is the script, not the Expert Advisor, that is suitable for your task!
Second,why do you use this design?
And the root of your problem.
Well, the last you have very much messed up in a simple program describe what you want from this program and let's try to write the script step by step nicely!
The first thing that catches your eye is that you are using the EA as an ordinary script. Read the manual to see how they are different. It is the script, not the Expert Advisor, that is suitable for your task!
Second,why do you use this design?
And the root of your problem.
And finally, you are making too much noise in a simple program, describe what you want from this program and let's try to write the script step by step!
Vitaly, thank you for your reply!
1)About the script, I understand you, I'll try.
2)Well, everything is simple, I interrupt the for loop.
3) I want to create an Expert Advisor or a script that will download quotes for certain instruments + timeframes, specific news by specific date and time.
The final result of writing to the file should look like this
And so on different instruments+timeframes+newsand dates.
There is one more nuance. If the data is unloaded on the 60 minute timeframe, then the quotes should correspond to the 16:00 and 15:00 timeframes.
If the news timeframe is 14:45, then the quotes should correspond to the time:
1 minute - 14:45
5 minutes - 14:45
15 minutes - 14:45
30 minutes - 14:30
60 minutes - 14:00
I hope I made myself clear. Thank you
Look at this loop again! The variable count is only changed by the for statement itself, so if is just superfluous in this loop.
Let's now define how we will process the data. It seems to me that it would be more logical to read from the news file the news parameters, process the data and write them into the file of quotes. Collecting an array of news that then have to run through an array again for one record does not seem rational, in addition, very often in the processing of arrays can make a lot of errors associated with indexes.
Look at this loop again! The variable count is only changed by the for statement itself, so if is just superfluous in this loop.
Let's now define how we will process the data. It seems to me that it would be more logical to read from the news file the news parameters, process the data and write them into the file of quotes. Collect an array of news, that then again to run through an array for one record does not seem rational, in addition, very often in the processing of arrays can make a lot of errors associated with indexes.
I mean, create files with quotes in advance and add news parameters to the file?
You mean create the quote files in advance and add the news parameters to the file?
You don't understand me, we read from the news file, process it and immediately write it into the quote file and so on until the whole news file is processed!
That's what I'm trying to do, only through arrays. How would you write such code?
Why should I use the array where it's not needed? The simpler the code, the fewer errors you can make!
I'm learning to work with arrays through this code. After all, the task is not complicated in principle.
The "Open" quotes are already stored in the array above. Therefore, I need just to pull out the quote of the date I need from the array.
I am learning to work with arrays through this code. After all, the task is not complicated in principle.
The "Open" quotes are already stored in the array above. Therefore, I just need to pull the quote of the date I need from this array.