1. How to place a bet on either Under or Over in the current Over/Under x.5 market?

To back or lay on Under X.5 or Over X.5 where X is the current number of goals scored, e.g. Under 0.5 when the score is 0 – 0 or Over 2.5 when the score is 0 – 2 or 1 – 1, add the following two conditions to your trigger (they’d preferably go first in the list):

Market’s Betting Code is Over/Under market_score1 + market_score2 + 0.5
and Selection’s Index is equal to INDEX

Where INDEX is the index of the selection: 1 is for Under, 2 is for Over.

So to bet on Over 1.5 when the score is 1 – 0, you will need the following pair of conditions:

Market’s Betting Code is Over/Under market_score1 + market_score2 + 0.5
and Selection’s Index is equal to 2

The internal variables market_score1 and market_score2 return the first and second number in the current score (their values are updated automatically as teams score during the game).

2. How to stop betting after X losses in a row

The internal variable losses returns the number of consecutive losses, i.e. the length of the latest losing streak. To stop a trigger from acting once the number of losses has reached X, add this condition to that trigger:

and Selection’s Trigger Expression losses is less than X

Similarly, the variable wins returns the number of consecutive wins in a row. For this reason, never name your variables with a text string that contains "wins", e.g. my_wins, because the “wins” may be parsed incorrectly.

3. How to bet on the favourite if its volume of matched bets is greater than the cumulative volume of money matched on the 2nd, 3rd and 4th favourites?

The percentage of the total market money matched on the given selection is available through the volume variable. There is also a trigger condition allowing you to check the volume percentage, so the condition would be:

Favourite’s Volume% is greater than r_2_volume + r_3_volume + r_4_volume

Note that r_2_, r_3_ and r_4_ are prefixes to address the 2nd, 3rd and 4th favourites.

Here is a situation in which this condition will be met:

 Favourite's volume percentage

4. My trigger places Dutching bets on the first three favourites. How do I increment a variable in that same trigger, i.e. add 1 to that variable?

A trigger action will be performed as many times as the number of matching selections. So if you do Dutching on the first three favourites, it means the trigger will seek to execute all of its actions three times – for each favourite.

If you add an action for setting a variable, like this:

Two actions in a trigger condition

the trigger will add 3 to bet_cntr in total, not just 1. So if bet_cntr had been equal to 2 before the trigger fired, then afterwards it will be equal to 5, not 3.

To work around this, you can insert an IF statement to add 1 to bet_cntr only for the first matching selection:

Correct formula for incrementing a variable 

The expression IF(match_index=1, bet_cntr+1, bet_cntr) says literally the following: if this is the first matching selection, add 1 to bet_cntr, otherwise keep the existing value of bet_cntr.

5. I have two triggers, one of which lays and another one cancels any unmatched bets left after the first trigger. How do I make sure that the second trigger waits until the bets made by the first trigger are registered in the system?

Indeed, if you let both trigger fire one after another, the bets placed by the first trigger may not have reached the exchange yet, so the second trigger will think that there are no bets at all or it may try to cancel some other, older bets.

To avoid this, you need to space the two triggers in time.

Setting a timestamp variable 

By adding a timestamp user variable last_bet_time to the first trigger, you get the opportunity to check how much time has passed since the laying before performing any other actions.

If you have not heard of BetFair yet or do not have an account, register today and get £20 free. Use the link below:
New customers only, bet up to €/£20 on the Exchange and if your first bet loses, we’ll refund you €/£20 in Cash. Bet must be placed in first 7 days of account opening. T&Cs apply.
Gamble responsibly! Always be aware that betting is NOT risk-free. You must be 18+ years old before you try gambling, but even as an adult, withhold from spending money in an ill-judged manner. Our company does not encourage you to prefer gambling over other meaningful activities. If gambling is affecting your life or the lives of people close to you, please contact GamCare
© 2005-2021 WellDone Creative Software. All rights reserved. Terms and conditions.
BetFair® and the BetFair Logo are registered trade marks of Flutter Entertainment plc. Gamble responsibly.