How to implement the closing of positions one at a time after N minutes ? - page 3 123456789 New comment [Deleted] 2017.11.22 19:17 #21 Ihor Herasko: Excuse me. The line:needs to be rewritten like this:(OrderCloseTime()> 0) works, I'll leave it like that thenThanks again))Renat Akhtyamov:закрытие по тикету, переделайте под свойAlso closes fine, but after closing it writes error 4108"Invalid ticket number." Renat Akhtyamov 2017.11.22 19:42 #22 Natalya Dzerzhinskaya: (OrderCloseTime()> 0) works, I'll leave it that way thenThanks again)))Also closes fine, but after closing it says error 4108"Wrong ticket number."So it's really wrong, won't lie.Look into your code logic.And you do one command to close or two?If you've closed it once, there's nothing to do for the second, and the previous ticket will already be invalid. [Branch closed!] EURUSD - Error "unknow ticket" is Contact and Support is Taras Slobodyanik 2017.11.22 19:53 #23 Renat Akhtyamov: So it's really wrong, it won't lie.Look into the logic of your code.Do you run one close command or two?If you close once, there is nothing to do for the second, and the previous ticket will already be incorrect.Your code's"close" variable will never be less than zero, read the help. Taras Slobodyanik 2017.11.22 19:57 #24 Ihor Herasko: Fair points above. Why go through all the orders again if the ticket is already known? You can close the orders immediately, when the overshoot is done. Why search for time? Compare - close - next. Renat Akhtyamov 2017.11.22 20:06 #25 Taras Slobodyanik: your code's "close" variable will never be less than zero, read the helpread it yourself...-----------Return value Returns true if the function completed successfully or false if there was an error. To get the error information you need to call GetLastError(). Коды возврата торгового сервера - Коды ошибок и предупреждений - Стандартные константы, перечисления и структуры - Справочник MQL4 docs.mql4.com GetLastError() - функция, возвращающая коды ошибок. Кодовые константы ошибок определены в файле stderror.mqh. Для вывода текстовых сообщений следует использовать функцию ErrorDescription(), определенную в файле stdlib.mqh. Taras Slobodyanik 2017.11.22 20:11 #26 Renat Akhtyamov: Read for yourself...-----------Returned value Returns true if function completed successfully or false in case of error. To get information about the error, call GetLastError().you don't even know the difference between types of variables)you need to learn. Renat Akhtyamov 2017.11.22 20:11 #27 Taras Slobodyanik: so you don't even know the types of variables)You need to learn. Forum on trading, automated trading systems and strategy testing How to implement closing positions one by one after N-minutes ? Natalya Dzerzhinskaya, 2017.11.22 19:17 (OrderCloseTime()> 0) works, I will leave it that way thenThanks again)))Also closes fine, but after closing it writes error 4108"Invalid ticket number." Is it from the sky or something?) Good luck with your studies! OrderModify error 4108 after Errors, bugs, questions stuck Vitaly Muzichenko 2017.11.22 20:28 #28 Renat Akhtyamov: Does it come out of the sky or something?) Good luck with your studies!Under what conditions could it ever work, even once every 100 years? if(OrderSelect(MyTicketBuy, SELECT_BY_TICKET)==true) { close=OrderClose(MyTicketBuy,OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),0,clrRed); if(close<0){if(Fun_Error(GetLastError())==1)return;} } if(OrderSelect(MyTicketSell, SELECT_BY_TICKET)==true) { close=OrderClose(MyTicketSell,OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),0,clrBlue); if(close<0){if(Fu n_Error(GetLastError())==1)return;} } Renat Akhtyamov 2017.11.22 20:30 #29 Vitaly Muzichenko: Under what conditions could it ever work, even once every 100 years?Well Vitaly, I don't know...............You've got it in your post working out...... Careful, the function is on the previous page. Vitaly Muzichenko 2017.11.22 20:34 #30 Renat Akhtyamov: Well Vitaly, I don't know...............You've got it in your post...... Careful, the function is on the previous page.My point is thatclose can only be either 0(false) or 1(true), there is no other.The same, for reliability it is better to write:close=OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),0,clrRed); 123456789 New comment
Excuse me. The line:
needs to be rewritten like this:
(OrderCloseTime()> 0) works, I'll leave it like that then
Thanks again))
Renat Akhtyamov:
закрытие по тикету, переделайте под свойAlso closes fine, but after closing it writes error 4108"Invalid ticket number."
(OrderCloseTime()> 0) works, I'll leave it that way then
Thanks again)))
Also closes fine, but after closing it says error 4108"Wrong ticket number."
So it's really wrong, won't lie.
Look into your code logic.
And you do one command to close or two?
If you've closed it once, there's nothing to do for the second, and the previous ticket will already be invalid.
So it's really wrong, it won't lie.
Look into the logic of your code.
Do you run one close command or two?
If you close once, there is nothing to do for the second, and the previous ticket will already be incorrect.
Your code's"close" variable will never be less than zero, read the help.
Fair points above. Why go through all the orders again if the ticket is already known?
Why search for time? Compare - close - next.
your code's "close" variable will never be less than zero, read the help
read it yourself...
-----------
Return value
Returns true if the function completed successfully or false if there was an error. To get the error information you need to call GetLastError().
Read for yourself...
-----------
Returned value
Returns true if function completed successfully or false in case of error. To get information about the error, call GetLastError().
you don't even know the difference between types of variables)
you need to learn.
so you don't even know the types of variables)
You need to learn.
Forum on trading, automated trading systems and strategy testing
How to implement closing positions one by one after N-minutes ?
Natalya Dzerzhinskaya, 2017.11.22 19:17
(OrderCloseTime()> 0) works, I will leave it that way then
Thanks again)))
Also closes fine, but after closing it writes error 4108"Invalid ticket number."
)
Good luck with your studies!)
Good luck with your studies!Under what conditions could it ever work, even once every 100 years?
Under what conditions could it ever work, even once every 100 years?
Well Vitaly, I don't know...............
You've got it in your post working out......
Careful, the function is on the previous page.Well Vitaly, I don't know...............
You've got it in your post......
Careful, the function is on the previous page.My point is thatclose can only be either 0(false) or 1(true), there is no other.
The same, for reliability it is better to write: