"Ask" is guaranteed to contain the actual data in only 2 cases:
1) at the beginning of "start()" function;
2) immediately after "RefreshRates()" invocation.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
"...Just one question, is
equivalent to
MarketInfo (Symbol(), MODE_ASK)?"
Answer : Not equivalent.
"MarketInfo(...)" always returns actual data.
"Ask" is guaranteed to contain the actual data in only 2 cases:
1) at the beginning of "start()" function;
2) immediately after "RefreshRates()" invocation.
Please, see => https://docs.mql4.com/predefined/variables/ask .
I think i have found why it doesn't work:
I'm using an Oanda practice acount, and i think SL and TP are disable with ORDER_BUY.
If i replace OP_BUY with OP_BUYLIMIT it's working well!!!