Download MetaTrader 5

Help me get OrderOpenPrice and OrderClosePrice???

To add comments, please log in or register
Văn Liên Đỗ
12
Văn Liên Đỗ  

Hello everyone!
i'm newbie trader and I want to learning code EA!‌

I have a question want ask everyone!

I want to get point OrderOpenPrice and OrderClosePrice of orderclosest but I don't know right way???

Please help me!‌

PS: sorry, I speak a little English!

Thank you so much!!!‌

Fernando Carreiro
3393
Fernando Carreiro  
sieutaymay: i'm newbie trader and I want to learning code EA!‌ I have a question want ask everyone!

I want to get point OrderOpenPrice and OrderClosePrice of orderclosest but I don't know right way???

Please help me!‌ ‌PS: sorry, I speak a little English! Thank you so much!!!‌

  1. MQL4 or MQL5? I will assume MQL4 because those functions only exist in MQL4.
  2. Did you read the documentation for the two functions?
    Here are the links:
  3. Those functions are only valid if you use the OrderSelect() function and it is successful (very important).
  4. Read the documentation on all Trade Functions so you can have a better idea of all of them as a whole.
  5. Have a look at the CodeBase as there are many examples of code for you to use as a reference for your own code.
OrderOpenPrice - Trade Functions - MQL4 Reference
OrderOpenPrice - Trade Functions - MQL4 Reference
  • docs.mql4.com
OrderOpenPrice - Trade Functions - MQL4 Reference
Văn Liên Đỗ
12
Văn Liên Đỗ  
Fernando Carreiro:
  1. MQL4 or MQL5? I will assume MQL4 because those functions only exist in MQL4.
  2. Did you read the documentation for the two functions?
    Here are the links:
  3. Those functions are only valid if you use the OrderSelect() function and it is successful (very important).
  4. Read the documentation on all Trade Functions so you can have a better idea of all of them as a whole.
  5. Have a look at the CodeBase as there are many examples of code for you to use as a reference for your own code.


thank you so much!!!

I get it by:


if(OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)==true)
{
double price=OrderClosePrice();
if(price>0) Print("Price Open: ", price);
price=OrderOpenPrice();
if(price>0) Print("Price Close: ", price);

}
else
Print("OrderSelect failed error code is",GetLastError());

whroeder1
16304
whroeder1  
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it

  2. if(OrderSelect(1,SELECT_BY_POS,MODE_HISTORY)
    You assume history is ordered by date, it's not. Could EA Really Live By Order_History Alone? (ubzen) - MQL4 forum
To add comments, please log in or register