12345678902003 #: 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.
Artyom Trishkin #: 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.
[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:
template<typename T>
bool StringToEnum(conststring i_str, T &o_val)
{
for(inti = INT_MIN; i <= INT_MAX && !IsStopped(); i++) // перебор всех возможных значений int
{
o_val = (T)i;
if(i_str == EnumToString(o_val))
return(true);
}
o_val = WRONG_VALUE;
return(false);
}
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
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:
template<typename T>
bool StringToEnum(conststring i_str, T &o_val, int i_min_enum, int i_max_enum)
{
for(int i = i_min_enum; i <= i_max_enum && !IsStopped(); i++)
{
o_val = (T)i;
if(i_str == EnumToString(o_val))
return(true);
}
o_val = WRONG_VALUE;
return(false);
}
bool StringToEnum(conststring i_str, T &o_val) { return StringToEnum(i_str, o_val, INT_MIN, INT_MAX); } // медленный вариант
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.