Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1876

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
What's the point of all this? You want to replace numeric values of ENUM_TIMEFRAMES with your own? Or what?
Help please, I draw two Gann lines and they intersect at a certain point, I need to know the coordinates of the intersection point of these lines.
The straight line equation is a help
Get the prices from the straight lines on each bar and compare or find the difference, in places where the signs of the crossing differences change) There may be no equalities on the bar, by the way.
Get the prices from the straight lines on each bar and compare or find the difference, in places where the signs of the crossing differences change) There may be no equalities on the bar, by the way.
Good afternoon, all.
I am rewriting an EA from MQL4 to MQL5. I do not understand how to get the reason for closing a position by SL.
I need it to make a decision on what to do next.
In MT5 terminal, you can select a trade, order or position in history window.
For MQL this function will not work correctly
https://www.mql5.com/ru/docs/strings/stringcompare
Parameters
string1
[in] The first string.
string2
[in] Second string.
case_sensitive=true
[in] Case sensitive mode. If true, then "A">"a". If false, then "A"="a". The default value is true.
If there will be two constants in enum, for example ENUM1 and enum1, then at i_str:"enum1" function can return the value of constantENUM1. Why StringCompare at all? If it can be done in the following way:
I need it to make a decision on what to do next.
In the history window of the MT5 terminal you can select a deal, order or position.
In the trading history you need to look for a trade with DEAL_REASON equal to DEAL_REASON_SL.
Added: It can be simplified - in OnTradeTransaction just catch the transaction TRADE_TRANSACTION_DEAL_ADD and calling to trade history look for DEAL that created this transaction. And then the same recipe: ... DEAL_REASON equals DEAL_REASON_SL
The function will not work correctly for MQL
https://www.mql5.com/ru/docs/strings/stringcompare
If there are two constants in enum, for example ENUM1 and enum1, then with i_str:"enum1" the function may return the value of constantENUM1. Why do we need StringCompare anyway? If it can be done in the following way:
And a faster variant:
What is all this for? Do you want to replace the numerical values of ENUM_TIMEFRAMES with your own? Or what?
Well, right now I need to write the settings of indicators and EA's parameters in the database. At the same time I would like to have:
1. human-readable records
2. machine-readable records
3. The stability to add new values in custom enum, not necessarily at the end.
There is no problem with record - EnumToString, but developers did not make reverse function, unlike all other types.