Is ERR_TRADE_TOO_MANY_ORDERS (148) likely to happen and if it occurs + orderModify happens then...?

 
//ERR_TRADE_TOO_MANY_ORDERS
case 148:
                /*On some trade servers, the total amount of open and pending orders can be limited.
                If this limit has been exceeded, no new position will be opened (or no pending order will be placed)
                and trade server will return error 148 (ERR_TRADE_TOO_MANY_ORDERS). 
                ref: MQL4 Reference - Trading functions - OrderSend
                -
                The amount of open and pending orders has reached the limit set by the broker. New open positions and
                pending orders can be placed only after the existing positions or orders have been closed or deleted
                ref: https://championship.mql4.com/2006/news/8
                */

Above taken from code: /*.....*/ are mixture of docs and forum notes...


Given above blurb:

Let's say max open+pending orders "...has reached the limit set by the broker." ref: ERR_TRADE_TOO_MANY_ORDERS (148)


So ok, error code is detected and flag set to inhibit further OrderSend()s until it is seen that less than broker limit, at this time another order could be considered.

However during the time that EA at this limit, the code continues to do other open trade maintenance duties each time start() called eg, monitoring/moving TPs and SLs etc.

You know... in cruise mode just dreaming about massive income while the orders do their thing and we just tweak around the edges via orderModify ;)


And that would seem where can come unstuck because OrderModify() closes original order and reopens new order with requested mods and issues new ticket#

(which has to be discovered by EA using magic#... nice one MT)

btw support: since modify is type bool - why not do something really useful and make type int?

A return value like OrderSend() does and give out the ticket# of the new/modded order.

This is a real no-brainer solution to current non-clever I/F. Take a few mins to do?

You must have that new ticket# somewhere and modify builtin could lay hands on it, yes?

(rant over ;)

1)

If at this broker max value and then decide time to move SL on market order, modify issued.

Will the broker refuse this modify order or will broker allow?

Would seem all based on how modify implemented on server: is possible that will now go max+1 and that's not allowed according to docs.


2)

.Of course if 148 never likely to happen - can forget all of above (I think ;)

it goes without saying that am inferring that a well behaved EA would qualify for the "never likely to happen" wording simply due to never issuing massive number of open,pending orders.

But that is not a solution - just a fingers crossed kludge...


3)

how does one learn what is this maximum limit set by broker?

IF there is such a datum THEN is easy to build code around this knowledge and have happy error handler function and start() too, yes?

ELSE seems back into the usual guessing game again regards error handling.


All comments valued

:o)


Regards

Reason: