Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 351
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Good day !
The problem arose out of the blue, the Expert Advisor was working, no problems, but as soon as I inserted a new function (trailing stop), OrderSelect did not work in my entire EA and error 4051 ERR_INVALID_FUNCTION_PARAMVALUE - Invalid value of function parameters. At first I didn't understand it, I thought I may have changed something somewhere, I removed trailing stop and returned everything as it was, but OrderSelect still generates error.
Here is the code just in case:
Good day !
The problem arose out of the blue, the Expert Advisor was working, no problems, but as soon as I inserted a new function (trailing stop), OrderSelect did not work in my entire EA and error 4051 ERR_INVALID_FUNCTION_PARAMVALUE - Invalid value of function parameters. At first I didn't understand it, I thought I may have changed something somewhere, I removed trailing stop and returned everything as it was, but OrderSelect still generates error.
Here is the code just in case:
Here is the code just in case: for(int i = OrdersTotal(); i > 0; i--)
we need for (int i = OrdersTotal() -1; i>=0; i--) the orders are numbered starting from zero, so the largest number is 1 less than the number
we need for (int i = OrdersTotal() -1; i>=0; i--) the orders are numbered from zero and therefore the highest number is 1 less than the number
Exactly! I didn't notice that... I need more sleep![](https://c.mql5.com/3/158/pardon__1.gif)
We need for (int i = OrdersTotal() -1; i>=0; i--) the orders are numbered from zero and therefore the highest number is 1 less than the number
Thank you !
This is not serious... What are they (input and extern) for then....
What's not serious about it? You asked a question in the code branch and got an appropriate answer.
Well, if you have not thought to restart the terminal, you have already been answered - servicedesk.
It's hard to guess how you did that. I don't want to show you the code of the Expert Advisor, and I'm too lazy to look through it all. Make a copy under a different name, delete everything except parameters and empty function OnTick (or Start ???). Is the effect still there? Show the resulting code
Did it help? How did it work before?
I'm sorry, but I don't understand why oncalculate should pass values of predefined variables if they are global and also available
Hello, I want to make an EA based on an indicator, I copied the indicator code into ontick, I'm missing the variables from the onCalculate function, I need to get it all through copytime copyhigh copylow, etc. or is there an easier and faster way?
iCustom to the rescue