It happens often that a trade does not execute as you expect - either due to a bug in your code, or because trading is not allowed due to weekend or other reasons. Your code, as far as I see, is ok.

You can often quickly find the reason when you activate LOGFILE, and/or use the printf function so that you see if you attempted to open a position on a Saturday, or if the if(..) condition was true or not.