ArrayMaximum Returns -1
ArrayMaximum(Valores); // WHOLE_ARRAY
- Please don't post images of code or messages, copy and paste using the CODE button (Alt-S)
-
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't
use it. It's use is always wrong
In your case you are normalizing, already normalized values.- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 and MetaTrader 4 - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 and MetaTrader 4 - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 and MetaTrader 4 - MQL4 programming forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
int tipo_op, if(tipo_op == 0) if(tipo_op == 1)
Don't hard code constants. Write self-documenting code, use the proper constants.
whroeder1:
- Please don't post images of code or messages, copy and paste using the CODE button (Alt-S)
-
Do NOT use NormalizeDouble, EVER. For ANY Reason. It's a kludge, don't
use it. It's use is always wrong
In your case you are normalizing, already normalized values.- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 and MetaTrader 4 - MQL4 programming forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 and MetaTrader 4 - MQL4 programming forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 and MetaTrader 4 - MQL4 programming forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 and MetaTrader 4 - MQL4 programming forum
- Lot size must also be adjusted to a multiple of LotStep and check against min and max. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- Don't hard code constants. Write self-documenting code, use the proper constants.
Thanks,i appreciate the points you said and i 'll look better to fix it. Thanks !!!
Bilal Said:
Hi,I'm trying to get the highest value from array but i'm receiving -1 when using ArrayMaximum
CopyHigh it's filling the array correctly
And what will happen when it's not the case ?
You can see the values of the array and the code :
Any opinion why i'm getting this error ?
Thanks for the attention !
Always check the return value of a function and process it.
With mql5, the second parameter is "start" index, not count, please check the documentation.
Hi,I'm trying to get the highest value from array but i'm receiving -1 when using ArrayMaximum
CopyHigh it's filling the array correctly
You can see the values of the array and the code :
Any opinion why i'm getting this error ?
Thanks for the attention !