Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 353
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
I don't get it. This option indicates the location of the file - \MetaQuotes\Terminal\Common. Without this option I won't be able to grab the file that was generated in the tester. Without this option the file will be searched in MQL4\Files - and I won't be able to put the file from the tester there.
It was the absence of this flag that I pointed out.
It was the absence of this flag that I pointed out.
Thanks for your help - it's just a typo - I know this flag. The problem is not solved - the file doesn't want to open in shared read mode - even without using the tester. As long as this file is open by the indicator - the script can't open it. Notepad, on the other hand, opens it without any problems.
Thanks for the help - it's just a typo - I know that flag. The problem is not solved - the file doesn't want to open in shared read mode - even without using the tester. As long as this file is opened by the indicator - the script can't open it. Notepad, on the other hand, opens it without any problem.
Try forcing data to disk periodically by FileFlush().
hmmm: another thing I didn't notice right away
tvv:
ExtHandle=FileOpen(c_symbol+(string)20+".csv",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_READ|FILE_SHARE_READ|FILE_COMMON);
The file in the script is opened as follows: ExtHandleR=FileOpen("EURUSD20.csv",FILE_BIN|FILE_READ|FILE_SHARE_READ);
Please point out my error.
Try periodically forcing data to disk with FileFlush().
Hint: Another thing I noticed a while back
It's strange that it reads. There should be a FILE_CSV flag..CSV is a file extension - you can use any extension - I chose it so you can look it up in Notepad. Here is an interesting article - https://www.mql5.com/ru/articles/2720. My code complies with the rules described there - but I can't read the file programmatically. in FILE_SHARE_READ mode. For file EURUSD20.HST with extension .HST - flag must be FILE.BIN, so that in MT 4 file can be opened offline.
.CSV is a file extension - it can be anything - I chose it so I could look it up in Notepad. Here is an interesting article - https://www.mql5.com/ru/articles/2720. My code complies with the rules described there - but I can't read the file programmatically. in FILE_SHARE_READ mode. For file EURUSD20.HST with extension .HST - flag must be FILE.BIN, so that in MT 4 file can be opened offline.
I tried to work not in the tester but just on a normal chart (EURUSD M1) - I run the indicator that generates the TF M20.
To open the file:
ExtHandle= FileOpen("EURUSD20.csv",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_READ|FILE_SHARE_READ).
The file will then appear in the MQL4\Files folder. Then we run the script on a regular chart (EURUSD M5) which copies the content of EURUSD20.csv to EURUSD20.HST. File EURUSD20.HST is generated in the history folder in the same directory as MQL4.
The script code:
ExtHandleR=FileOpen("EURUSD20.csv",FILE_BIN|FILE_READ|FILE_SHARE_READ) read file;
ExtHandleW=FileOpenHistory("EURUSD20.hst",FILE_BIN|FILE_WRITE|FILE_SHARE_WRITE|FILE_SHARE_READ);
Everything works only when I remove the indicator from the M1 chart. That is, I don't have the file sharing read mode working.
Hello! What is the metatrader glitch on the eurodollar chart? A daily candle for Sunday 9.10.2011 appeared, on the hour chart there is only one hour 23:00 for that date. This is probably due to the change of clocks to winter time. How to fix it? There was no such candle before.
The problem is solved as follows: The program writing the file must close FileClose after each write operation, thus freeing the file for another program to read. This is because the data is first written to the buffer and is not physically present in the file for some time. Closing the file releases the buffer into the file. Before the next write
the file is reopened and the pointer is moved to the end of the
Hello! Can you tell me if it is correct to say that the number of points obtained will be the same in both expressions? It's really important to me!
More precisely, can't the points be negative??? Or is it still.....))
Good evening.
I started studying mql5 and have some questions, so please help.
The task is to get the values of the last n candlesticks into an array and sort the array by choosing only the unbeaten candlesticks.
I have written the function:
It generates an errorarray out of range.
As far as I understood, this error is caused by addressing a non-existing cell of the array.
But I could not find the error from the move, please advise where I messed up, or maybe there is a more elegant sorting.
Good evening.
I started studying mql5 and have some questions, so please help.
The task is to get the values of the last n candlesticks into an array and sort the array by choosing only the unbeaten candlesticks.
I have written the function:
It generates an errorarray out of range.
As far as I understood, this error is caused by addressing a non-existing cell of the array.
But I could not find the error from the move, please advise where I messed up, or maybe there is a more elegant sorting.