I don't know if you have seen my entry about the new issue with different results when using a TMF (http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=455104#Post455104). It also happens in 1.36.5, at least Stop and TakeProfit are effected when calling a TMF, they seem to be modified by a hidden mechanism although they are left untouched by script. So IMO you actually can not rely on results when involving TMFs.
Ah, no, I had not seen it. Of course, this script will produce a random result. You're not returning anything from your TMF, so it just closes or continues the trade randomly, depending on the printf return value.
A TMF that does nothing must return 0. Omitting the return value won't work.
The print command returns any value other than zero? Okay, I did not consider this. Setting explicitly 'return 0' at the end of the TMF produces same results as without the TMF. Thanks!