Questions from Beginners MQL5 MT5 MetaTrader 5 - page 953
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
Where would I use it?
This whole idea is that let's say I have directories with files for processing at "..\MQL5\\Files\00\dir_01" address. Using your wonderful code, I get the path to these folders in an array and want to access these files, knowing exactly what files should be processed, and I have to write the path to them, for example "MQL5\\Files\\\00\dir_01\\A\test.csv" and the code returns "MQL5\Files\00\\dir_01\A\", and I am asking if I can modify it to return the optimal path that will be applicable in further code.
Where would I use it?
This whole idea is that let's say I have directories with files for processing at "..\MQL5\\Files\00\dir_01" address. Using your wonderful code, I get the path to these folders in an array and want to access these files, knowing exactly what files I need to process, and I need to set path to these files, for example "MQL5\\Files\\\00\dir_01\\A\test.csv" and the code returns "MQL5\Files\00\\dir_01\A\", and I am asking whether it can be modified in order to return the optimal path that will be applicable in further code.
You just don't understand what a double slash is - it's one character which is denoted by two in the syntax: first slash command, second slash what.
\n, \r, \t, \" and \\\ are characters that are set by this rule. I.e. there is always one slash in the path.
You just don't understand what a double slash is - it's one character, which in syntax is denoted by two: the first slash command, the second slash what.
\n, \r, \t, \" and \\\ are characters that are set by this rule. I.e. there's always one slash in the path.
I don't exclude that I'm missing something, but I need two slashes to generate file path, not one.
I don't rule out that I'm misunderstanding something, but I need two slashes to generate the file path, not one.
You don't need two slashes.
Try to print one, two, or three slashes into the log. Maybe you will understand then.You don't need two slashes.
Try to print one, two, or three slashes into the log. Maybe then you will understand.Yes, I understand that the slash is a command, but I need to write the path, and I use double slash for that.
Here's the path.
I got a string in the array Folders[0]:
00\dir_01\A\
I want to access a file with the same name but in different directories by changing the index of the array.
but this command will get an error, won't it?
That's a waste.
Hello!
I'm trying to switch from MQL4 to MQL5 and I cannot find the last closed position.
In MQL5, when we send an order, it is an order, and when it is opened it becomes a position, and logically it should be placed in position history and the deleted pending orders should be placed in order history, but all I see is the history of orders from deals, so I do not know where to find a closed position.
I tried this way:
But it displays numbers of both opened and closed positions. ORDER_TYPE always shows 4, which is also not clear.
I tried to change ORDER to DEAL, but it does not work either.
Please, help me, what is wrong?
Vladimir, thank you.I am already familiar withRefreshRates function fromCSymbolInfo class.I've seen it in your works and read it in a primer.
The call of this function inOnTick and output of price values inComment are also clear to me from the example. The procedure inOnInit to check the current symbol is also clear to me.
While waiting for the example with the new bar, I will try to put some practice with your example, I haven't used it in practice. I will try it.
So, this example works only at the moment when a new bar is born.
This example uses static variablesPrevBars,prev_ask andprev_bid. The essence of static variables is.
Local variables declared with the static keyword retain their values forthe lifetime of the function. With each next call of the function, these local variables contain the values they had in the previous call.
So our three static variables(PrevBars,prev_ask andprev_bid) are local variables declared inside OnTick function and they store their values, which they had when they entered OnTick function previously.
PrevBars stores the time of the previous bar. This time is compared totime_0, the time of the current bar. As long asPrevBars is equal totime_0, we are at the current bar and exit the OnTick function. The same with the variables that store the prices of the previous bar: we first display the previous and current prices and then write the current prices into the variablesprev_ask andprev_bid.
Forum on Trading, Automated Trading Systems and Strategy Tests
FAQ from Beginners MQL5 MT5 MetaTrader 5
Aleksey Vyazmikin, 2018.12.05 00:39
I know it's a slash command, but I need to write the path.
Here's the path let's say
I got a string in Folders[0] array:
00\dir_01\A\
I want to access a file with the same name but in different directories by changing the index of the array.
but this command will get an error, won't it?
There will be no error. You still haven't figured out what a double slash is.
Yes, I understand that the slash is a command, but I need to write the path, and I use double slash for that.
Here's the path for example
I got a string in the array Folders[0]:
I want to access a file with the same name but in different directories by changing the array index.
but this command will get an error, won't it?
Alexey, take an example from the documentation
and print the two string variables highlighted in the example code. Find the differences and understand that the double slash is only written in the program code, but only one is left at compile time and one is used in the file path.