Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1582
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 is highlighted in yellow is that we first declared the price variable and assigned the Ask price value to it, and literally after the line where the order type is checked, the Bid value is assigned accordingly.
Question - why can't we assign Bid at the stage of declaring the price variable at once, or is there some sacred meaning here?
If you assign Bid at once, you will still have to check the order type and assign Ask :-)
The price variable should be assigned one of two values depending on the order type. The initial one is Ask, and if the type does not fit, it is changed to Bid.
it's just that code authors don't like the triple operator : double price=(orderType==ORDER_TYPE_SELL?Bid:Ask) ; // so shorter and clearer in my opinion.
If you assign Bid at once, you will still have to check the order type and assign Ask :-)
The price variable should be assigned one of two values depending on the order type. The initial one is Ask, if the type does not fit, change it to Bid.
it's just that code authors don't like the triple operator : double price=(orderType==ORDER_TYPE_SELL?Bid:Ask) ; // so shorter and clearer in my opinion.
Thank you, Maxim, for your help! Now everything is clear and logical. It turned out like this:
Two lines less, but more understandable. ))
Regards, Vladimir.
And if EA is set on more than one pair?
OrderCheck() is more reliable.I don't understand, is the second line a statement or what?
Well, what difference does it make how many pairs the EA is installed on? Each code is executed separately. Let even on one symbol, on different charts, with different mags will be installed... No problem....
Hi Alexey, I understand your option, Vitaly's hint is also reasonable.
But still! That code is taken from an article written by MetaQuotes specialists, and I have no reason not to trust them. I just had a question that I would like to get an answer to. ))
Regards, Vladimir.
MQ specialists are people too and it is also natural for them to get tired and make some "mistakes" which do not affect the code performance.
MQ specialists are people too and they also tend to get tired and make some "mistakes" that do not affect the code's performance.
So in fact there is no error, it's just that the code is written in such a way that I didn't "get into" its essence at once and that's why I tried to understand it. )) Maxim explained everything clearly. In short, a big THANK YOU to everyone!!!
Regards, Vladimir.
Double-click in an empty space of the order window to enable/disable the display of ticks in the order window.
Actually, this double-click can be done anywhere in the order window, as long as it is not on the "sell/buy by market" buttons ;-)
Please help me, stop points do not work when debugging. No matter which stop point I set, the whole programme is executed after debugging is started. How to make stop points work?