# 23/05/2019

### 1. How to get the number of remaining idle markets in My Markets?

There is a number of trigger variables for refreshing, settled and in-play markets, as well as a variable for the total number of markets in your list. Depending on your needs, you can combine these variables to control the number of markets you are working with. The answer to the question would be:

`market_num - susp_market_num - inplay_market_num - settled_market_num`

The full list of these variables is available in the manual, section Triggered Betting – Reference – Variables – General.

### 2. How to pick a set number of selections that fit the given conditions?

If you need, say, exactly 3 selections to bet on, you can make sure that the trigger picks no less than or no more than three, using the matching_number and match_index variables:

`[set of conditions] and Selection’s Trigger Expression matching_number is equal or greater than 3 and Selection’s Trigger Expression match_index is equal or less than 3`

The trigger will select the first three qualifying selections, sorted by price (from lowest to highest). To sort them according to some other criteria, use the Selection’s Sorting order defined by… condition.

If there are less than 3 selections available, the conditions will not be met.

### 3. How to set an interval of N markets/minutes between the executions of a trigger?

See this trigger example:

Setting a time/market interval between the triggers

### 4. How to make my bets matched at the closest available price when placing them using a trigger?

Set the “Price” field of the trigger to the following expression:

For backing:
`r_ticks(back_price, -N)`

For laying:
`r_ticks(lay_price, N)`

Where N is the maximum number of ticks you are prepared to worsen your price offer. So suppose you intend to back at the price of 4.4, but are willing to give in by 5 ticks to get your bet matched. Then you should write:

`r_ticks(back_price, -5)`

BetFair will automatically distribute your offer among the best available prices, but no lower than 3.95.

### 5. I bet in several Over/Under football markets per match, and I use Market Locator to search for markets with sufficient volume of bets. Some of the target markets may not be included due to low volume. How do I make sure that the triggers do not bet in such events where some of the markets are missing?

You can find out if a market is present in My Markets by checking one of its parameters with a known value, for example, the number of selections, which in Over/Under markets is always equal to 2. If the parameter is not equal to 2, this means the market is not there. For example, for an Over/Under 2.5 goals:

`Selection’s Trigger Expression football8_runner_number is equal to 2`

If this condition is false, the trigger will not bet. You can include this condition (and similar ones, e.g. Selection’s Trigger Expression football1_runner_number is equal to 3 for “Match Odds” in Football) in any trigger that places bets in any market of the event. So you can, for example, check this condition from inside the Correct Score market – it does not matter because the prefix football8_ allows you to access Over/Under 2.5 goals from any market of the match.

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