Hi Mark
That is the problem, that everything stops once race_count has been reached.  I'm trying to create a trigger which analyzes the last 10 races as an ongoing process, not a one off snapshot.
I'll try and give an example to explain further:
1st 10 races of the day the fave wins 4 races spread through the 10 races:
Race 1  Race 2  Race 3  Race 4  Race 5  Race 6  Race 7  Race 8  Race 9  Race 10
Win       Win       Loose     Loose      Win      Loose    Win      Loose     Loose     Loose
so, in the first 10 races the fave has won 4 out of 10 races, so 40% of the previous 10 races
The fave then looses both race 11 and race 12 of the day:
Race1  Race 2  Race 3  Race 4  Race 5  Race 6  Race 7  Race 8  Race 9  Race10  Race 11 Race 12
Win       Win      Loose      Loose     Win      Loose   Win    Loose      Loose    Loose     Loose      Loose 
so, in the last 10 races the fave has now only won 2 out of 10 races, so 20% of the previous 10 races.
I'm trying to just work out the number of winners in the previous 10 races, but that figure is constantly evolving.
Hope that makes sense!