Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 431
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
You can. But be careful. For an open position, it returns the closing price. Correspondingly: for Buy - Bid, for Sell - Ask
I thought OrderClosePrice() can only be taken from a closed position.
the help doesn't say anything about it)
o. I didn't know it could be used like that.
I thought OrderClosePrice() could only be taken from a closed transaction.
there's nothing about it in the help)
Undocumented feature. But there are some conventions. I don't remember which ones at the moment. You need to ask Alexey @Alexey Viktorov - he wrote about them recently.
An undocumented possibility. But there are some conventions there. I can't remember which ones at the moment. Ask Alexey @Alexey Viktorov - he wrote about them recently.
Isn't the variable initiated by zero immediately?
What about this code?
The variable is not immediately initialized with zero?
Do not rely on the defaults. It is better to be concerned with its value when declaring a local variable: bool pr=false;
In general, of course, it is unnecessary to set it there. It is sufficient to check what the function returns:
if(!OrderClose()) Print("Bummer");
How do I know the Fibonacci fan price of a previous candle? MQL5
ObjectGetValueByTime() does not work, it returns 0, then high, then low candle
@ArtyomTrishkin
Good afternoon. Please help. tell me what's wrong with my indicator. I do not understand why it does not draw anything at all.
https://www.mql5.com/ru/forum/224805#comment_6372281
This is an undocumented feature. But there are some conventions. I don't remember which ones at the moment. I need to ask Alexey @Alexey Viktorov - he wrote about them recently.
It was such a long time ago... but still managed to find it. Renat explains in clear terms why it is undesirable. But in my opinion, it is not that bad. The problem may occur when we get a requote at order closing. If we set the Ask or Bid price in the request, we can always refresh the price and try again. And in the case of specifying the close price OrderClosePrice(), we will have to select the order repeatedly in order to refresh the order data.
Conclusion: If you can't, but really need to, you can.
Please advise! I read data from a CSV file, including a column with a price with a place separator "." (1.22426) via FileReadString(handle), then via StrToDouble function, everything is OK. But there is a column with the price also, but it is already delimited by "," (1,22426) and StrToDouble fails to read it. What to do, if there is no possibility to change comma to dot in CSV itself ?
Please advise! I read data from a CSV file, including a column with a price with a place separator "." (1.22426) via FileReadString(handle), then via StrToDouble function, everything is OK. But there is a column with price that is already separated by "," (1,22426) and StrToDouble fails to read it. What can I do if I can't change comma to a dot in CSV ?
FileReadString
and then you can change it from a comma to a dot:
StringReplace
Replaces all found substring in string with given sequence of characters.
intStringReplace(
string&str,//pattern in which the substitution will be performed.
const stringfind,// sought substring
const string replacement// substring to be substituted
);
FileReadString
and then you can change from a comma to a full stop:
StringReplace
Replaces all found substring in the string with a given sequence of characters.
intStringReplace(
string&str,// string to be replaced
const stringfind,// sought substring
const string replacement// substring to be substituted
);
Thank you!) , variable Cena=FileReadString(handle); I insert into function Separator=StringReplace(Sepa,",","."); it writes error "implicit conversion from number to string" -
doesn't want to read value with separator "," (1,22426) as a string, and StringReplace doesn't work. Or am I doing it wrong?