deleting all pending if found one working order

Back to topics list  | 1 2 To post a new topic, please log in or register
avatar
1001
dabbler 2012.02.12 20:19 #
 
RaptorUK:

Why not . . .

Not tested or tried to compile it . . .

Sneaky! You are going back to the beginning of the loop when you find the valid trade. That is clever.

I would never compare to #define'd symbols with greater than or lesser than. They are symbolic forms and relying on their actual values is poor programming practice. Gain 1 point for sneaky trick and lose two for using greater/lesser comparison on #defined symbols :-)

 
avatar
14167
RaptorUK 2012.02.12 20:30 #
 
dabbler:

Sneaky! You are going back to the beginning of the loop when you find the valid trade. That is clever, although you would want to use

pos= OrdersTotal()-1; <<<

I would never compare to #define'd symbols with greater than or lesser than. They are symbolic forms and relying on their actual values is poor programming practice. Gain 1 point for sneaky trick and lose two for using greater/lesser comparison on #defined symbols :-)

<<< I wondered about that, wasn't sure if it would then be decremented by the for loop next run through . . . making it OrdersTotal() - 2
 
avatar
1001
dabbler 2012.02.12 20:48 #
 
deVries:


You check in one time not only if there are open buys and/or sells (nOpenOrders)

but also the total with pending include (EAtrades)

Only when nOpenOrders > 0 and when the total trades > nOpenOrders you have to delete the pending

In that case the check is done atonce

If all pending are deleted the next tick this loop for deleting pending will not be done again.....

I think it is faster...

This sort of test takes very little computational effort so I wouldn't bother. I prefer Raptor's solution, not just because it is faster, but also because it removes a lot of duplicated code; time to code and debug is part of the total cost of the EA.
 
avatar
2408
avatar
1001
dabbler 2012.02.13 00:55 #
 
RaptorUK:
<<< I wondered about that, wasn't sure if it would then be decremented by the for loop next run through . . . making it OrdersTotal() - 2
I think you are right; I'm just being a dumb arse tonight :-)
 
Back to topics list   | 1 2  

To add comments, please log in or register