12/09/2019

1. How do I check the price of the favourite team in Match Odds (football) if I want to bet in Over/Under 0.5 goals?

You must add and refresh both Match Odds market and the market where you want to execute your trigger.

In the trigger conditions, add:

Selection’s Trigger Expression IF(football1_s_1_sel_order > football1_s_2_sel_order, football1_s_2_back_price, football1_s_1_back_price) is less than/greater than/is between X

The football1_ prefix gives you access to the Match Odds market.

Note: you can’t just use football1_r_1_back_price, i.e. the price of the first favourite, because the Draw selection can have the lowest price at that moment.

2. How to execute a trigger once a day at a pre-set time?

You can create a trigger that will fire at a certain time in the day. Using the actions of that trigger, you can do whatever you need: assign values to some variables, reset the win/lose history, etc.

Here is an example:

Reset all variables at a set time

As you can see, the trigger is set to be executed once in every 3 minutes, i.e. in the 5-minute time frame between midnight and 00:05 it will fire only once.

The only prerequisite here is that you need to refresh at least one market during that time frame, even if you do not intend to bet in that market. This is needed to actually initiate the actions of the trigger, because triggers can only run in refreshing markets.

3. How do I alternate between backing and laying in two triggers? E.g. if I backed in one market, I want to lay in the next, and then again back, and so on.

Download the ready solution (a trigger file).

Use these triggers as a template. Edit the conditions of the backing and laying triggers to add any additional conditions (for price, number of selections, time, etc).

What do these triggers do?

They use two variables, bet_cntr and bet_type, to control the bet placement. The bet_cntr variable is a flag for the end of an event. It is needed to prevent the triggers from betting twice in the same market. The bet_type variable is a switch between backing and laying. Once a backing trigger has fired, it switches bet_type to 2, which stands for laying. In the next event, the laying trigger places its bet and switches bet_type to 1, for backing, and so on.

4. How do I code handicap values in triggers for Asian Handicap, such as +0&0.5, -1.5&2.0?

Use the handicap variable for digital values of handicaps:

Selection’s Trigger Expression handicap is equal to 0.75

To calculate the digital handicap, simply get the average of any numbers denoting the handicap. For example, if it’s -3.5, then the handicap will be that number, -3.5. If it is -3.0&-3.5, then it’ll be (-3.0-3.5)/2 = -3.25. For -3.5&-4.0, the handicap will be (-3.5-4.0)/2 = -3.75.

To double check your calculations, switch to the Engineer Mode and view the variable handicap for each selection in the market:

Asian Handicap

5. How do I get the total potential profit or loss from closing all bets across all refreshing markets?

Use the triggers below. Add them to your trigger block (on top of other triggers) and then check the value of the global_sum variable, which will contain the total tradeout P/L.

Download the triggers.

6. I want to bet on every selection in every market in my list once an hour. This generates hundreds of bets to be placed simultaneously, which causes MF Pro to freeze. What can I do?

This is a case study of a more complicated set of triggers.

Laying every hour

You need to distance the bets in the time, i.e. place them one after at another at 1 sec. intervals. This will give MF Pro the opportunity to process all the bets without freezing. For this purpose, you need to create a repeatable block of triggers. The betting trigger must be inside this block. Let’s say you want to lay.

So after the trigger lays, it will increment a variable, bets_placed, which is a counter of bets placed. Once this counter is equal to the number of selections in the market, the trigger stops. But each time the trigger places a bet only on one selection.

Then you have the trigger that closes and repeats the block. This will happen once an hour, thanks to the last_bet_time variable which holds the time of the latest bet placed. The conditions of the closing trigger checks that there must be at least frequency minutes since the time of the last bet, where frequency is the constant for the frequency of sets of bets, e.g. once in 60 minutes.

Use the trigger file below as a template for similar solutions.

Download the trigger file.

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-2023 WellDone Creative Software. All rights reserved. Terms and conditions.
BetFair® and the BetFair Logo are registered trade marks of Flutter Entertainment plc. Gamble responsibly.