[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 157

 
wolf05632:
Hello all! Tried through search - did not find! How to break a long line of code into several shorter ones?

Give me an example.

If we are talking about comparison (if), then you can write in variables of bool type - each condition in a separate line, and in the final if substitute only variables.

 

Dear Professionals, the tester gives an error:

ERR_INVALID_FUNCTION_PARAMVALUE4051Invalid function parameter value


Here is the log in the log file:

2011.09.08 20:40:02 2010.12.28 10:00 Robot 2 EURUSD,H1: open #277 buy 0.50 EURUSD at 1.32316 ok

2011.09.08 20:40:02 2010.12.28 09:00 Robot 2 EURUSD,H1: OrderClose error 4051

2011.09.08 20:40:02 2010.12.28 09:00 Robot 2 EURUSD,H1: Invalid ticket for OrderClose function

2011.09.08 20:40:02 2010.12.28 09:00 Robot 2 EURUSD,H1: close #276 buy 0.50 EURUSD at 1.32347 at price 1.32114


I.e., it trades fine before and after it. Please, tell me, what it means and how to correct it?

 
TheXpert:
So the MCs have to go through the whole terminal because you can't count the zeros?

Bummer? It is a bug and should be fixed like any other.

At Avto-VAZ, they probably reason the same way you do - the driver is bored to run after the car to collect the falling out pieces of iron, and they have to dig through the whole car because of it?!

 
Xaoss1990:

Dear professionals, the tester is giving out an error:

Can you please tell me what this error means?
it says

2011.09.08 20:40:02 2010.12.28 09:00 Robot 2 EURUSD,H1: Invalid ticket for OrderClose function
 
sergeev:
it says



What does it mean? Wrong order number for the close order function? I.e. is it trying to close an order that does not exist?
 
Xaoss1990:
What does this mean? The wrong order number for the function to close the order? I.e. it's trying to close an order that doesn't exist?

Add some temporary Alerts to the OrderClose() module, and put variables in them (ticket number, etc.) - then check their values in the log.

 
chief2000:

Give me an example.

If it's about comparison (if), you can write in bool variables - each condition on a separate line, and put only variables in the final if.




We are talking about "WOW"! Suppose a long mathematical expression. In VBA, let's say, to split a long string in two, in any valid place of this string we need to put _

and the remaining expression can be added on a new line.

 
chief2000:

Add some temporary Alerts to OrderClose() module, and put variables (ticket number etc.) in them - then check their values in the log.



Added, this is what I got:

2011.09.08 21:26:15 2010.01.13 11:00 Robot 2 EURUSD,H1: open #12 buy 0.10 EURUSD at 1.45027 ok

2011.09.08 21:26:15 2010.01.13 17:00 Robot 2 EURUSD,H1: close #12 buy 0.10 EURUSD at 1.45027 at 1.45083

2011.09.08 21:26:15 2010.01.13 17:00 Robot 2 EURUSD,H1: Alert: OrderTicket() = 12, lots = 0.1, Bid = 1.4508

2011.09.08 21:26:15 2010 01.13 17:00 Robot 2 EURUSD,H1: Invalid ticket for OrderClose function

2011.09.08 21:26:15 2010 01.13 17:00 Robot 2 EURUSD,H1: OrderClose error 4051

2011.09.08 21:26:15 2010.01.14 01:00 Robot 2 EURUSD,H1: open #13 buy 0.10 EURUSD at 1.45243 ok

And so on....

I do not understand what is the reason for this error ((

 
Xaoss1990:

I have added it, this is what I got:

2011.09.08 21:26:15 2010.01.13 11:00 Robot 2 EURUSD,H1: open #12 buy 0.10 EURUSD at 1.45027 ok

2011.09.08 21:26:15 2010.01.13 17:00 Robot 2 EURUSD,H1: close #12 buy 0.10 EURUSD at 1.45027 at price 1.45083

2011.09.08 21:26:15 2010.01.13 17:00 Robot 2 EURUSD,H1: Alert: OrderTicket() = 12, lots = 0.1, Bid = 1.4508

2011.09.08 21:26:15 2010 01.13 17:00 Robot 2 EURUSD,H1: Invalid ticket for OrderClose function

2011.09.08 21:26:15 2010 01.13 17:00 Robot 2 EURUSD,H1: OrderClose error 4051

2011.09.08 21:26:15 2010.01.14 01:00 Robot 2 EURUSD,H1: open #13 buy 0.10 EURUSD at 1.45243 ok

And so on....

I do not understand what causes this error ((

I have given an example of how to debug the problem, and then you have to sort out the code.

Here is an example of solution in one case: "Invalid ticket for OrderClose function" - https://www.mql5.com/ru/forum/100874

If that doesn't help, there's Google.

 
chief2000:

I gave an example of how to debug the problem, and then you have to figure out the code.

Here is an example of a solution in one case: "Invalid ticket for OrderClose function" - https://www.mql5.com/ru/forum/100874

If it doesn't help, there's Google.

I can't figure out what this error #=4051 means

ERR_INVALID_FUNCTION_PARAMVALUE4051Invalid function parameter value


What does it mean? Incorrect order number for the function to close the order? I.e. it is trying to close an order that does not exist?

It comes out as soon as the order is closed with a stop. And the stop triggers...

Help, please... I've been struggling for days....

Reason: