Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 901
![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
This could not be the case, there is no way the Ask on the Kangaroo could be higher than any opening price on the Eurodollar in 2015...
And all checks for the selected order should be done after the selection, with a separate if() clause.
That's right, it couldn't. That's why it gave out Bid<openPrice orders on eu at 1.11262.
In other words, do you suggest to check for the presence of an order using the if(OrderSelect()), and then in the embedded if we already compare the chart symbol with the order symbol, open price, etc.?
That's right, it couldn't. That is why it gave out a Bid<openPrice order for the eu at 1.11262.
In other words, do you suggest to check for an order using the if(OrderSelect()), and then compare the chart symbol with the order symbol, open price, etc., in the embedded if?
Dancing around will not help.
There is no difference to write order selection and check for symbol and magician in one line or divide them into 3 different lines. According to changes in new builds check conditions are checked in stages, i.e. if the first condition is not fulfilled, the following ones will not be checked. It is the same as the 3 lines. The first condition is fulfilled and the second one is checked. And only if the second condition is also fulfilled we proceed to check the third one.
The problem is probably that there is a call of a user function in the deleted part of the code where another order is selected.
If there had been any mention of working with orders, that would have been the first thing I noticed. But there's only calculations, not a single user function used. It's not clear what exactly causes an order to be selected from another pair. That's why I'm so puzzled by the "software environment" mentioned in the documentation and have already redone the code as evillive suggested and am ready to dance with tambourines. The next perversion will be a forced comparison with bid\ask of the required pair via marketinfo.
UPD.: Problem solved. Actually found a nested function that uses its own OrderSelect. Thanks for the idea, AlexeyVik.
I have created an EA (not for work, just for practice)
If I set both parameters in IF function, if I set them one by one, everything will work fine, here's the code (Also, how do I make sure that if I already have an open Buy order the next Buy order won't open, even if all the conditions match)?
I have created an EA (not for work, just for practice)
If I set both of them one by one it works fine, i.e., the code (and if I already have an open Buy order, how do I make a Buy order not to open next one, even if all conditions are correct?)
Not that it is the source of all troubles, but purely from academic interest: why simultaneously OnInit(), OnDeinit() and then suddenly start()?
And as for the question, it is strongly not recommended that such a comparison Ask == MA, very rarely comes true on history. So, what does such an expression PC-->MA mean?
As for the permission for one Buy, we loop through all market positions and compare them with the specified criteria - symbol, type, magic number, and increase the counter by one if the sought one is found. Then, where necessary, this counter is checked.
That's the way it is:
Not that it is the source of all troubles, but purely out of academic interest: why simultaneously OnInit(), OnDeinit() and then suddenly start()??
And as for the question, it is strongly not recommended that such a comparison Ask == MA, it very rarely comes true on history. So, what does this expression PC-->MA mean?
As for the permission for one Buy, we loop through all market positions and compare them with the specified criteria - symbol, type, magic number, and increase the counter by one if the sought one is found. Then we look at the counter where necessary.
start() changed the counter out of "habit" )
Why is Ask == MA a rare event? Does the current bid price rarely touch the Moving Average line?
The PC-->MA is in my case if the previous close price is higher than the Moving Average line (I haven't figured out another way).
So, when I enable the IF function one by one with Ask == MA and then PC-->MA it works fine, but when I combine them, it does not work!
Not that it is the source of all troubles, but purely out of academic interest: why simultaneously OnInit(), OnDeinit() and then suddenly start()??
And as for the question, it is strongly not recommended that such a comparison Ask == MA, very rarely comes true on history. So, what does such an expression PC-->MA mean?
As for the permission for one Buy, we loop through all market positions and compare them with the specified criteria - symbol, type, magic number, and increase the counter by one if the sought one is found. Then, where necessary, this counter is checked.
That's how it is:
My understanding is that PC-- > MA is the same as PC-1 > MA.
My understanding is that PC-- > MA is the same as PC-1 > MA
So it is! But why doesn't it work in this combination?
Although, in the picture below, it all adds up.