retracted
@uzben
i think you miss the point. firstly, if (OrderSelect()==true ) does not compile as it requires parameters.
i understand fully what OrderSelect(...) does, i am simply trying to VALIDATE that OrderSelect(...) HAS BEEN CALLED.
when you develop an api that other programmers will use, you need to assume that at some point they will make a mistake, and be able to prevent that mistake having undesired consequences.
hence a validation mechanism to detect if it has been called is needed.
- Please edit your post and use SRC button when you post code.
- If you develop an API, you have to use OrderSelect IN your API, otherwise it's bad design. You can do that implicitely, or explicitely by providing a wrapper function to OrderSelect().
- Please edit your post and use SRC button when you post code.
- If you develop an API, you have to use OrderSelect IN your API, otherwise it's bad design. You can do that implicitely, or explicitely by providing a wrapper function to OrderSelect().
the mq4l api internally does what i was requesting. do they internally have wrappers? no.
i will figure it out, and share my findings with you.
the mq4l api internally does what i was requesting. do they internally have wrappers? no.
i will figure it out, and not share my findings with you.
the mq4l api internally does what i was requesting. do they internally have wrappers? no.
i will figure it out, and not share my findings with you.
for(int i = OrdersTotal()-1; i >= 0 ; i--) { if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==false) break;
your problem how to select an order is solved this simple. It is not needed you share it with angevoyageur, ubzen or with me
we know how to use loops for selecting trades we have made on our account
we have several ways to check every trade from our account to select the trade we want to check if we have to manage that trade
... For you jon1 there will never be a selected trade with OrderOpenTime() == 0
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
#define ERR_NO_ORDER_SELECTED 4105
after some trial and error, this seems to work.
if you want to write a function for example called OrderCloseIfProfitable(), you need to somehow determine if the caller previously called OrderSelect with a valid ticket/position index.
this enables you to do that, with minimum fuss.