Fred,
The trigger logic seems to be wrong. If you are trying to access the winner through the pw_ variable inside the market that has been settled, it does not make sense, because pw_[index]_ gives you a reference to the winner of the previous markets, not the current one.
If you tell us in more details what you are trying to achieve, I'm sure I'll be able to help with triggers.