-
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - You can not use any Trade Functions until you select an order.
whroeder1:
-
Why did you post your MT4 question in the
Root /
MT5 General section
instead of the
MQL4 section, (bottom of the Root page?)
General rules and best pratices of the Forum. - General - MQL5 programming forum
Next time post in the correct place. The moderators will likely move this thread there soon. - You can not use any Trade Functions until you select an order.
Now I changed the bot a little and selected the Order, but it still doesn't print the right OrderOpenTime. Can you tell me what I did wrong now? Thanks!
This is the code:
#property strict int buyTicket; int counter = 1; double price; void Ontick)= { if(counter == 1) { buyTicket = OrderSend(_Symbol,OP_BUY,0.01,Ask,3,0,0,NULL,0,0,Blue); price = OrderOpenPrice(); counter = 0; } OrderSelect(buyTicket,SELECT_BY_POS,MODE_TRADES); Print("Order Open Price: ",OrderOpenPrice()); } //+------------------------------------------------------------------+
It prints that:
- Oliver Podolak:but it still doesn't print the right OrderOpenTime. Can you tell me what I did wrong now?You're not printing it.
price = OrderOpenPrice();
What part of "You can not use any Trade Functions until you select an order," was unclear?-
Check your return codes (OrderSend, OrderSelect) for errors, report them and you would know why.
Don't just silence the compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after. - What position is buyTicket?
whroeder1:
Thank you very much. Now it works :)
- You're not printing it.
- What part of "You can not use any Trade Functions until you select an order," was unclear?
-
Check your return codes (OrderSend, OrderSelect) for errors, report them and you would know why.
Don't just silence the compiler, it is trying to help you.
What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
Only those functions that return a value (e.g. iClose, MarketInfo, etc.) must you call ResetLastError before in order to check after. - What position is buyTicket?
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
Hello,
I place an Order, but I get the Wrong Order open time. Can someone tell me, where the error is?
My code:
thank you :)