Would this system ever invest in stock when the probability of losing all the money is non-zero?
Nope. And if what you're after is the best long-run result and your utility is anything like logarithmic in wealth, this is exactly what you want.
(Although if Pr(lose everything) is small enough then the observation that you almost always get approximately the expectation in the long run is irrelevant unless the run is infeasibly long. So you might want to truncate your return distributions somehow, if you're prepared to accept a tiny probability of ruin for doing better almost all the time.)
[EDITED to add a missing right-parenthesis.]
Let's suppose you start with $1000 to invest, and the only thing you can invest it in is stock ABC. You are only permitted to occupy two states:
* All assets in cash
* All assets in stock ABC
You incur a $2 transaction fee every time you buy or sell.
Kind of annoying limitations to operate under. But you have a powerful advantage as well. You have a perfect crystal ball that each day gives you the [probability density function](http://en.wikipedia.org/wiki/Probability_density_function) of ABC's closing price for the following day (but no further ahead in time).
What would be an optimal decision rule for when to buy and sell?