HELPPPPP!!!!!! trying to close pending orders - page 2

 
GumRai:

How can it be ok?

The loop only checks the first order, so there may be a buy order, but if it is not in the highest position, it will not be detected.

If last was not buy than he needs to delete pending. If it is buy than he do not want to delete pending.

What is the problem? 

 
eevviill: If last was not buy than he needs to delete pending. What is the problem? 
  1. Wrong. If the last was not a buy then it is a pending. No deletions unless there is a buy somewhere.
  2. If the last is a pending, and the code does not delete anything. Go look at the code again.
 
removing else worked. Thank you. didnt know else only look at previous trade only
 
Removing the else was not the answer, moving the return false outside the loop is.