Author Topic: Moving Average of the Favourite Winning  (Read 2946 times)

Tags:
  • All members
  • Posts: 405
Moving Average of the Favourite Winning
« on: 14 May 2014, 10:53 »
Hi Everybody

I'm struggling to work out a way to do this.  I want to produce a trigger to see how many times the favourite has won in the last 10 races.  This calculation will change with each result that comes in as I want it to only look at the last 10 races.  Ideally the number of races (10 in my example) would be a constant that could be adjusted.

As always, any help greatfully received.

  • Moderator
  • Posts: 3597
*
Re: Moving Average of the Favourite Winning
« Reply #1 on: 14 May 2014, 21:01 »
Hi
Please have a look at the attached screenshot.
It will update 2x counters: races_counter and win_counter

I have assumed a win to be selections lay price is equal to 1.01
This can probably be done another way using pw_ (previous winner) but the trigger becomes more complex that way.

Hope this helps.  
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 405
Re: Moving Average of the Favourite Winning
« Reply #2 on: 15 May 2014, 07:46 »
Thanks for your help Mark

A quick question.  Won't the variable win_counter just keep rising?  I'm trying to see how many faves have won in the previous 10 races to create an average figure...in your example the formula for that would be:

(win_counter/races_counter)x100

As you can see, if win_counter records all data from the start of the day, that calculation goes wrong, as races_counter stays at 10 while win_counter records all results rather than only the previous 10.

I need win_counter to just reference the most recent 10 races, and this is where I'm struggling.


  • Moderator
  • Posts: 3597
*
Re: Moving Average of the Favourite Winning
« Reply #3 on: 15 May 2014, 09:09 »
Hi
win_counter has the condition:
update races counter number of runs is greater than 0
so it updates once per market up to the number of times the races counter has executed, which is limited to race_count value.

Everything should stop as soon as race_count is reached. I tested it briefly last night and it seemed OK. Give it a whirl and if it does not work let me know and I'll look at it again.
Please read the following disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 405
Re: Moving Average of the Favourite Winning
« Reply #4 on: 15 May 2014, 13:13 »
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!



  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: Moving Average of the Favourite Winning
« Reply #5 on: 15 May 2014, 13:27 »
hi
you would have to use 10 variables to record the wins/losses and have them to advance after 10 races, so variable 1 takes the value of variable 2 etc etc.
you are better to ask for a trigger to be made, use this link.
http://community.welldonesoft.com/make-me-a-trigger!/


mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 405
Re: Moving Average of the Favourite Winning
« Reply #6 on: 15 May 2014, 14:46 »
will do, thanks for your help Markv & Mcbee

 

Please note, BetFair is seems to be currently OFFLINE