News
Current BetFair Sports API status: online. Current BetFair Games API status: online.

WellDone Betting Bots -- February 08, 2012, 18:26
Pages: 1
Print
Author Topic: Problem checking how long selection remained favourite  (Read 487 times)
DarkStorm
Jr. Member
**

Reputation: +1/-0
Good idea!
Posts: 61


« on: March 09, 2010, 14:34 »

What I am trying to do is write a trigger condition to check the favourite has remained the favourite for x seconds. X is obviously an integer of the users choice.

I unfortunately don't feel this is possible after having a thorough search in the manual including the forum for answers. The closest I can find is price/tick difference over a period of time more so than a selection remaining the favourite for a period of time.

For example:
Let's say I will use "Favourite" has remained "favourite" for 5 seconds

Can this be done?

Cheers Chris.
Logged


eeldergill
New member
*

Reputation: +0/-0
Posts: 22


« Reply #1 on: March 09, 2010, 15:22 »

Hi Chris
I think there are possible solutions, but I'm no expert. You could try to set up a remember trigger and execute it every 5 seconds (or whatever value you wish "X" to be). Call the trigger, say, favid. Set up a user variable to be executed once per second. Call it favtime. This user variable is really just a counter. Set the "Selections" box to "Favourites" The main condition of the user variable is that the Favourite's Name is equal to favid_sel_name, but you may have to add other subsidiary conditions, such as that the variable is set and stipulating that the number of places is = to 1 so that there is no confusion between win and place market values etc. The key part of the trigger would lie in  the user variable value. This should provide that whenever the name of the horse identified by the user variable is the same as the name of the horse in the remember trigger, then the user variable value must be increased by one. If the value reaches 5 then you know that the favourite has been the favourite for 5 continuous seconds. However, you must re-initialise the value of the user variabe favid to 0 whenever the name of the favourite in the user variable trigger is different to the value stored in the remember trigger, since this would indicate that there had been a change of favourite. I haven't tested a possible formula to insert in the value box of the user variable, but something like IF(favid_sel_name=favtime_sel_name,(favid+1),0). The zero in the formula is intended to reinitialise the variable whenever there is a change of leader, but you should also initialise favid to 0 before the race starts. You may well have to tinker with this formula to get it just so, but can highlight quickly any problem by monitoring the value in play of the user variable from the main market window of MF Pro by bringing up the user variable screen.
Regards
Ed.
Logged


DarkStorm
Jr. Member
**

Reputation: +1/-0
Good idea!
Posts: 61


« Reply #2 on: March 09, 2010, 17:58 »

Hi Ed

Thanks for the quick trigger template.

Your explaination was nice and easy to follow.

I only got to try it on one/two races so will give it a proper try tomorrows races.  
From looks of the log below the user variable is looking to be successful

-----------------------------------------
09/03/2010 17:40:50:   Market Horse Racing - Todays Card / 17:40 Sthl has been refreshed.
-----------------------------------------

Checking condition:  Favourite's Name is equal to favid_sel_name
Condition is false.  Selection "Fulford": the value is Fulford.
Remaining conditions in the block will not be checked.

-----------------------------------------
09/03/2010 17:40:51:   Market Horse Racing - Todays Card / 17:40 Sthl has been refreshed.
-----------------------------------------

Checking condition:  Favourite's Name is equal to favid_sel_name
Condition is true. valid for 1 selections: Fulford.
Checking condition: and  User Variable(s) favid are set
Condition is true. valid for 1 selections: Fulford.
A user variable has been set. Name: favtime, value: IF(Fulford=favtime_Fulford,(favid+1),0).

-----------------------------------------
09/03/2010 17:40:52:   Market Horse Racing - Todays Card / 17:40 Sthl has been refreshed.
-----------------------------------------

Checking condition:  Favourite's Name is equal to favid_sel_name
Condition is true. valid for 1 selections: Fulford.
Checking condition: and  User Variable(s) favid are set
Condition is true. valid for 1 selections: Fulford.
A user variable has been set. Name: favtime, value: IF(Fulford=IF(Fulford=favtime_Fulford,(favid+1),0)_Fulford,(favid+1),0).

We will see how things go tomorrow because on the race before this it picked no selection despite there being a favourite for over 5 seconds. This could be to do with resetting it's value back to "0" as you mentioned before. I'll be able to confirm this tomorrow.

Cheers Chris. Smiley
Logged


eeldergill
New member
*

Reputation: +0/-0
Posts: 22


« Reply #3 on: March 09, 2010, 18:24 »

Hi Chris
The user rvariable value formula is incorrect as can be seen from your log "IF(Fulford=IF(Fulford=favtime_Fulford,(favid+1),0)_Fulford,(favid+1),0)". The culprit is likely to be that you have not initialised the variable to 0 before the race (this would require another trigger but also called favid). You may also need to play around with "(favid+1)" to get the result you need, which is the existing value of favid + 1. The problem of "IF(Fulford=IF(Fulford=favtime_Fulford,(favid+1),0)_Fulford,(favid+1),0)" is explained in the user manual at page 186:

"If a user variable is not set, it is not parsed by the program and all references to this variables are not replaced by its value. For example, if you are going to use a variable "myvar", but have not executed a trigger which sets its value, then any expression containing this variable will not be evaluated correctly:
IF(back_price>2, 5, myvar)
This will return the same expression, without any change, because myvar is not defined yet. Beware that this may lead to loops, especially if you assign a variable the value containing a reference to this very variable. For example:
set user variable var1 IF(last_bet_pl>0, var1+5, 0)
This will result in var1's value becoming "IF(last_bet_pl>0, var1+5, 0)". Next time when the same trigger action is performed, and if var1 is still not set, the value of this variable will become "IF(last_bet_pl>0, IF (last_bet_pl>0, var1+5, 0)+5, 0)" and so on. To avoid this, use a trigger condition that checks whether the variable has been already set."

I'm pretty confident that the inherent logic of the approach suggested is correct and that you can design the trigger to do what you need.

Regards,
Ed.
Logged


DarkStorm
Jr. Member
**

Reputation: +1/-0
Good idea!
Posts: 61


« Reply #4 on: March 09, 2010, 23:27 »

You were right hadn't registered the variable.

It's acting quite strange how some races it will return a value for favtime where others it won't determine a value despite the favourites price being well seperated.

If we use the 14:30 Lingfield has a loop going here of 1,0,1,0,1,0

-----------------------------------------
09/03/2010 22:57:11:   Market Horse Racing - Todays Card / 14:30 Ling 10 Mar has been refreshed.
-----------------------------------------

Trigger conditions have been met and the trigger's state is remembered for market "Horse Racing - Todays Card / 14:30 Ling 10 Mar", selections: Hurakan.
The name under which the selections were remembered is "0"
Waiting for the next repetition...
Waiting for the next repetition...
Waiting for the next repetition...

-----------------------------------------
09/03/2010 22:57:16:   Market Horse Racing - Todays Card / 14:30 Ling 10 Mar has been refreshed.
-----------------------------------------

Trigger conditions have been met and the trigger's state is remembered for market "Horse Racing - Todays Card / 14:30 Ling 10 Mar", selections: Hurakan.
The name under which the selections were remembered is "0"
Waiting for the next repetition...
Waiting for the next repetition...

-----------------------------------------
09/03/2010 22:57:15:   Market Horse Racing - Todays Card / 14:30 Ling 10 Mar has been refreshed.
-----------------------------------------

Checking condition:  Favourite's Name is equal to favid_sel_name
Condition is true. valid for 1 selections: Hurakan.
Checking condition: and  User Variable(s) favid are set
Condition is true. valid for 1 selections: Hurakan.
A user variable has been set. Name: favtime, value: 1.

-----------------------------------------
09/03/2010 22:57:16:   Market Horse Racing - Todays Card / 14:30 Ling 10 Mar has been refreshed.
-----------------------------------------

Checking condition:  Favourite's Name is equal to favid_sel_name
Condition is true. valid for 1 selections: Hurakan.
Checking condition: and  User Variable(s) favid are set
Condition is true. valid for 1 selections: Hurakan.
A user variable has been set. Name: favtime, value: 0.

As you can see it's working better now...but still now there is a kind of loop that shouldn't be here seeing as the variables have all been declared...so chances are it's like you said I now need to work on the user variables main line of code

IF("favid_sel_name"="favtime_sel_name",(favid+1),0)

However, what you put together appears correct to me.  Shocked
IF (value is equal to value then (add 1 each time) else, return 0).

ALL sorted now.

Thank you Smiley
Logged


Pages: 1
Print
 
Jump to:  

Anone designed by pixelslot.
Powered by SMF 1.1.16 | SMF © 2011, Simple Machines