WRONG_VALUE is first time to see. Is it kind of EMPTY_VALUE?
I will study your code deeply...
You are welcome!
They are all constants and EMPTY_VALUE is more useful for indicator buffers as its value is (2147483647), while EMPTY and WRONG_VALUE both have a value of (-1).
However, I prefer using WRONG_VALUE (instead of EMPTY) because it can also be used with enumerations as it is implicitly cast.
EMPTY,WRONG_VALUE, INVALID_HANDLE, CLR_NONE, clrNONE are constants that return the value (-1), so when in doubt, always read the documentation (either online or by simply hitting F1 in MetaEditor).
Used with array functions. Indicates that all array elements will be processed. Means the number of items remaining until the end of the array, i.e., the entire array will be processed The NULL constant can be assigned to a variable of any simple type or to an object structure or class pointer. The NULL assignment for a string variable means...
They are all constants and EMPTY_VALUE is more useful for indicator buffers as its value is (2147483647), while EMPTY and WRONG_VALUE both have a value of (-1).
However, I prefer using WRONG_VALUE (instead of EMPTY) because it can also be used with enumerations as it is implicitly cast.
EMPTY,WRONG_VALUE, INVALID_HANDLE, CLR_NONE, clrNONE are constants that return the value (-1), so when in doubt, always read the documentation (either online or by simply hitting F1 in MetaEditor).
Additionally, WRONG_VALUE is A value; WRONG. The same also goes for NULL. With certain types, NULL isn't really null but it's a zero value, and can mess you up if you are coming from another language where null really is a sentinel value.
int x = NULL;
Print(x == 0); //true
These two value constants can be useful for checking enums and some MQL function returns for return errors, however, they should never be used in a place where a sentinel value is required. A sentinel value indicates that the variable has NOT been set and has "None" or "null" value. It is unfortunate that MQL doesn't have a universal sentinel value that evaluates in the implicit way that WRONG_VALUE does. I have found a solution to this problem, however, and you can install my None type library which will then allow you to use safe and unambiguous sentinel values for all types.
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.
Fernando san Obrigado!
WRONG_VALUE is first time to see. Is it kind of EMPTY_VALUE?
I will study your code deeply...
You are welcome!
They are all constants and EMPTY_VALUE is more useful for indicator buffers as its value is (2147483647), while EMPTY and WRONG_VALUE both have a value of (-1).
However, I prefer using WRONG_VALUE (instead of EMPTY) because it can also be used with enumerations as it is implicitly cast.
EMPTY, WRONG_VALUE, INVALID_HANDLE, CLR_NONE, clrNONE are constants that return the value (-1), so when in doubt, always read the documentation (either online or by simply hitting F1 in MetaEditor).
Hi,I want to know how to code the OrdersTotal() is changed(decreased).
For example, I have 5 orders now. OrdersTotal()=5.
If one order is closed (either TP or SL) and OrdersTotal() is now 4 orders, The number of order was decreased.
How can I know this?
Hi, nice to meet you all.
I have quection how to increased the order???
EX: this EA only open 1 trade, but i want to open more trades (3 orders) at same time.
extern double Lots = 0.01;
extern int StopLoss = 300;
extern int TakeProfit = 50;
int g_bars_92;
bool gi_96 = TRUE;
int init() {
if (Digits == 3 || Digits == 5) {
StopLoss = StopLoss;
TakeProfit = TakeProfit;
}
return (0);
}
int deinit() {
return (0);
}
int start() {
if (g_bars_92 < Bars && TOOC() == 0 && g_bars_92 != 0 && gi_96) OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, Bid - StopLoss * Point, Ask + TakeProfit * Point, 0, 0, 0, Red);
g_bars_92 = Bars;
if (TOOC() == 1) gi_96 = FALSE;
Comment("Error: ", GetLastError());
return (0);
}
int TOOC() {
int li_ret_0;
for (int l_pos_4 = 0; l_pos_4 < OrdersTotal(); l_pos_4++) {
if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES))
if (OrderSymbol() == Symbol()) li_ret_0++;
}
return (li_ret_0);}
}
You are welcome!
They are all constants and EMPTY_VALUE is more useful for indicator buffers as its value is (2147483647), while EMPTY and WRONG_VALUE both have a value of (-1).
However, I prefer using WRONG_VALUE (instead of EMPTY) because it can also be used with enumerations as it is implicitly cast.
EMPTY, WRONG_VALUE, INVALID_HANDLE, CLR_NONE, clrNONE are constants that return the value (-1), so when in doubt, always read the documentation (either online or by simply hitting F1 in MetaEditor).
Additionally, WRONG_VALUE is A value; WRONG. The same also goes for NULL. With certain types, NULL isn't really null but it's a zero value, and can mess you up if you are coming from another language where null really is a sentinel value.
These two value constants can be useful for checking enums and some MQL function returns for return errors, however, they should never be used in a place where a sentinel value is required. A sentinel value indicates that the variable has NOT been set and has "None" or "null" value. It is unfortunate that MQL doesn't have a universal sentinel value that evaluates in the implicit way that WRONG_VALUE does. I have found a solution to this problem, however, and you can install my None type library which will then allow you to use safe and unambiguous sentinel values for all types.
https://www.mql5.com/en/forum/285144/page9#comment_9176346