![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
It depends if the close price is stored or calculated on the fly. My guess is it's stored and updated whenever any of the other values are changed on the trade (or it is being closed)
Put this EA on a chart, then open a Buy for the Symbol the EA is on then look at the Experts tab, if you are correct OCP won't be updated, if I am correct OCP should be the same a Bid as a Buy is closed at Bid price.
No it is not. OrderCloseTime() is always zero.
It is Bid or Ask depending on order type. It is out of date exactly like Bid and Ask. Call RefreshRates(). Ref
Put this EA on a chart, then open a Buy for the Symbol the EA is on then look at the Experts tab, if you are correct OCP won't be updated, if I am correct OCP should be the same a Bid as a Buy is closed at Bid price.
I stand corrected, it does indeed appear to be updating correctly. It was a few months back when I saw this issue and I wondered if it was in the tester where I had noticed it. However, I've just ran the the test EA in the tester and it is working as expected (it always shows an up to date close price using OrderClosePrice()).
Regards, Paul.
double profitInAccountCurrency = OrderProfit() +OrderSwap() +OrderCommission();
OrderClosePrice() works as intended and always gives the ClosePrice.
Thanks for all the comments and discussion, really helped me a lot!
Open trades' OrderClosePrice() is 0.
Unfortunately I 've not seen any good answer. Here is mine:
Don't forget to call
function before a call of
Unfortunately I 've not seen any good answer.
I guess you didn't read all of the thread . . .
So . . .