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
What does the function TipoOrdem() do?
Return the order type of the ticket selected
This will return OP_BUY even when the OrderSelect() fails .... just in case you didn't know.
It is difficult to tell from the code, if TO is a Global scope variable, it would be unchanged, or would it? To be honest I don't know what happens when a Global scope variable is re-declared. Is it re-set to zero? In that case, you would certainly be correct.
Are "TO" and "ticket" Global scope variables ? They are both declared in 2 functions and referenced in start() with no declaration.
Why the need for the function TipoOrdem? It just makes the code more confusing, especially with variable being declared more than once.
I suspect that they are indeed Global scope and possibly the ticket number that the code is trying to modify is not the intended ticket number.
I briefly saw 130 when I tried to move the SL one point (1/10 pip, 5 digit broker) but couldn't reproduce it. Change your test to move the SL at least a pip.
My broker has 5 digits,
How I said, sometimes the OrderModify return OK, when the EA stop in this error its continue in a loop until lost the opportunity of lock the profit.
I am thinking in stop of use this function and use internal variable to control it, and then when I want to stop it I send an OrderClose(). Is a way, but not is a good way in my opinion.
It is difficult to tell from the code, if TO is a Global scope variable, it would be unchanged, or would it? To be honest I don't know what happens when a Global scope variable is re-declared. Is it re-set to zero? In that case, you would certainly be correct.
Are "TO" and "ticket" Global scope variables ? They are both declared in 2 functions and referenced in start() with no declaration.
Why the need for the function TipoOrdem? It just makes the code more confusing, especially with variable being declared more than once.
I suspect that they are indeed Global scope and possibly the ticket number that the code is trying to modify is not the intended ticket number.
It'll take priority over any global variable. By default Mt4 initializes it to 0 when declared like that. Can solve with something like int TO= -1;
The ticket in the function is the passed parameter. When he uses the function it'll only look at that value even if there's a global variable with the same name. Same goes for the TO.
Think about it like the variable i as in .. for( int i=0; i<OrdersTotal(); i++). People declare the i everywhere. Thats kinda what he's doing with his TO .. I'm guessing (haven't gone through all his codes).
It is difficult to tell from the code, if TO is a Global scope variable, it would be unchanged, or would it? To be honest I don't know what happens when a Global scope variable is re-declared. Is it re-set to zero? In that case, you would certainly be correct.
Are "TO" and "ticket" Global scope variables ? They are both declared in 2 functions and referenced in start() with no declaration.
Why the need for the function TipoOrdem? It just makes the code more confusing, especially with variable being declared more than once.
I suspect that they are indeed Global scope and possibly the ticket number that the code is trying to modify is not the intended ticket number.
"TO" and "ticket" is not Global scope variables. Both are reclared in fuctions start() and in TotalOrdersOpened()
Normally my EA work with two orders buy and sell with the same pair, and I use the function TipoOrdem to select the correct order that should apply it. Resuming is only to select the correct ticket.
"TO" and "ticket" is not Global scope variables. Both are reclared in fuctions start() and in TotalOrdersOpened()
Normally my EA work with two orders buy and sell with the same pair, and I use the function TipoOrdem to select the correct order that should apply it. Resuming is only to select the correct ticket.
If they are not Global scope, what values will they have in your modify code?
If they are not Global scope, what values will they have in your modify code?
ticket is a variable defined in scope of function start()
The complete loop is: