Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 148
![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
Hello.
The OrderSelect function returns error 0 (ERR_NO_ERROR - Trade transaction was successful)??
How to avoid this error?
I am attaching the program code and journal entries.
Regards. Shurkin.
2013.09.17 13:07:04 PoligonTd GBPUSD,Daily: removed
2013.09.17 13:07:04 PoligonTd GBPUSD,Daily: uninit reason 0
2013.09.17 13:07:04 PoligonTd GBPUSD,Daily: Kc: Str=#20552937 buy 1.00 GBPUSD at 1.55450; Tct 20552937; OdSmb ?
2013.09.17 13:07:04 PoligonTd GBPUSD,Daily: OrderSelect() returned error - 0
2013.09.17 13:07:04 PoligonTd GBPUSD,Daily: loaded successfully
Actually, there is no error of selection, the order with such a ticket does not exist.
Well... If there is no order with this ticket, OrderSelect() will return false
So, there seems to be an error, since we're moving to else. The question is why there is no error?
I can't figure out how to implement the logic with the least amount of effort.
If(...) set a stop order;
If(the order's lifetime>time) withdraw the order, and if(...) set a new order;
The difficulty is that there may be several positions which are already open, and how do we fight them all? What is the easiest way?
Thank you!
I'm thinking of abandoning the special init() function. I think this is the right solution, isn' t it?
The way I see it is this:
1. Declare a variable globally, for example, like this:
gInitTrue = false;
Then we create our own INIT:
At the very beginning of the start like this:
if (gInitTrue == false) myInit();
It would be interesting to hear the opinion of more experienced people on the suitability of this approach, as well as on the correctness of my proposed solution to this problem.More buffers.
I'm thinking of abandoning the special init() function. I think this is the right solution, isn' t it?
The way I see it is this:
1. Declare a variable globally, for example, like this:
Then we create our own INIT:
At the very beginning of the start like this:
It would be interesting to hear the opinion of more experienced people on the suitability of this approach, as well as on the correctness of my proposed solution to this problem.What's the novelty of feeling a new solution? :-))
One fucks. Never needed to do it that way.
Well... If there is no order with this ticket, OrderSelect() will return false
So, there seems to be an error, since we're moving to else. The question is why there is zero?
I checked - if ticket number matches - everything works fine,
If not - function returns False, but OrderSelect() is silent as nothing happens, ZERO and nothing happens.
What's the novelty of feeling a new solution? :-))
One fuckin' thing. Never needed to do it that way.
But more to the point? It's been discussed that INIT can fail in case of, for example, disconnects or other similar situations. Because it does not re-initialise the data itself afterwards, in case of contingencies, and it only runs once! Therefore, it is not really the right option.
The question is dull, but the answer is nowhere to be seen, or maybe I just looked wrong:
In functions, or maybe somewhere else, I've seen the & symbol after the data type and, if I'm not mistaken, once &&
func(int& mm_mode, string symbol, int magic,bool& stop) {
What is it for? What does it do? (Reference, if you can find out more about it)))
The question is dull, but the answer is nowhere to be seen, or maybe I just looked wrong:
In functions, or maybe somewhere else, I've seen the & symbol after the data type and, if I'm not mistaken, once &&
func(int& mm_mode, string symbol, int magic,bool& stop) {
What is it for? What does it do? (Reference, if you can find out more about it)))
And more to the point? It's been discussed that INIT can fail in case of, for example, disconnects or other similar situations. Because it doesn't re-initialise the data itself afterwards, in case of contingencies, and it only runs once! So, this is not exactly the right way to do it.