# Watching the odds changes using a filter

Searching for the matches according to the odds changes

In the following example, work with odds will be presented. The average odds per match (from all bookmakers in Trefik) will be compared and the odds will change against the original values. Of course, the odds on matches are constantly changing, and Trefik has tools to include odds changes into the strategy of selecting tips.

The search task for matches is as follows: "View matches where the odds for the outsider raised for 10%, odds for the favorite fell for 10%, the odds for the favorite is higher than the average value not more than for 10% and the odds for the outsider are higher than the average vaklue for at least 15%."

The Filter for the Offer window, Filter / Column and Filter / Conditions section will be used to resolve the job.

We will need to get the average odds of all bookmakers in Trefík. To do so, activate the Odds / Odds Level section in the Filter for the Offer window. Here you can enter a condition that does not limit the list of matches. This is just a guideline for considering the odds, which will make the average odds available in the Filter / Columns (similarly, the minimum and maximum listed odds will be available upon activation of this item, but they are not interested at this point).

To display the opening odds (from the same, ie active, bookmaker), you need to activate the Odds / "View older odds" section. We will set the number of minutes before the start of the match to 99999 (69 days before the start of the match, which for our purposes will correspond to the first listed odds /if the odds was not listed at the specified time, the first listed odds/ will be returned). At the same time, we activate the "Show odds separately" field - which will make the opening odds available in Filter / Columns.

The situation in the filter definition looks like this:

In the Filter / Columns section, the status is as follows:

.. OLD 1, OLD 2 columns are activated: these are the opening odds values (from the "View older odds" filter section.) The AV1 and AVG2 columns are also active (these are average odds for tips 1 and 2 .. from the "Odds Level" section of the filter) has already been moved away (in the bottom) and the odds on the draw have been hidden (deactivated by the COLUMN column).

Columns are bold in columns that are automatically derived from active items in the filter. We will create user columns in the following steps.

If we use the filter defined above even with the Columns section in the Offer window, we get:

.. next to each other we have currently the active odds, the opening odds and the average odds of the monitored bookmakers.

In order to meet our above-mentioned task, we create temporary columns with values corresponding to the odds ratio. In the Filter / Columns, we create four new columns using the button PLUS at the bottom left (they are not shown in bold, they are not derived directly from the filter but are user defined).

The two columns will include the current odds ratio for Tips 1 and 2 against the original odds for the same tips. These columns are called 1%orig and 2%orig. Functions used to define them: Share (between current odds and opening odds).

The other two columns will be created similarly to the average odds. We call it 1%avg and 2%avg.

Filter / Columns should look like this:

And the Offer window:

.. contains 4 newly defined columns. Their values are displayed in 3 decimal places. However, any additional calculations in Filter / Columns, or Filter / Conditions work with non-rounded values.

In our task, the favorite and outsider of the match are distinguished. For the sake of simplicity, we have to make sure that the favorite team has listed odds of less than 2.20.

To distinguish between favorites and outsiders, we need to define new columns in the Filter / Columns. This time there will be only two new columns. First we mark HOM_FAV, the second AWA_FAV. They will be 1 if the team (HOME / AWAY) is the favorite. To do this, we can use a comparison of the current odds for 1 / 2 with a value of 2.2. The function used will be SMALLER, so the returned value will be ONE when the condition is met (less than 2.20).

The definition of the new columns would be as follows:

And the new columns at the Offer window:

.. new columns have been moved in the Offer window by moving the headers right after the current match odds columns (so we can easily visually verify the correctness of the definition).

After changing the columns order / columns width at the Offer window it is possible to take the new column settings into the columns definition using the button FROM OFFER.:

.. so we can save the changed columns settings for the future use.

We have done the settings for displaying needed data for our task and we can continue with setting the conditions for searching the matches.

The conditions for the favorite and the outsider teams must be recorded at the section Filter / Conditions. This section is designed to enter columns for all available columns at the Offer window.

We must differ two situaions: 1) the favorite team of the match is the home team; 2) the favorite team of the match is the away team.

It is clear that the conditions for changing odds will be exactly the opposite in both cases (once set for home odds, a second for guest odds).

This will require one of the situations described. We can do so by OR (logical OR). If one of two conditions is met, the match will be displayed.

To do this, we need to define a structured condition with two branches connected by OR.

The first branch, that is, the home team is a favorite, starts writing right in the first line of the Filter / Conditions window. The new line is always created by the PLUS button. In the first line write "hom_fav" = (value) 1, as shown:

Before writing down the second branch of the condition (that is, where the guest is a favorite), it is necessary first to fully enter the condition for the first branch. When writing, however, we have to distinguish that it is a separate situation (one branch) and the conditions to separate to the next level. This can be done by pressing the +++ button at the bottom. This will also visually display a new level of condition separation, and we can gradually write all conditions from the first branch:

.. in the second row it is stated that the 2%orig column must have a value of at least 1.10. This means that the odds for tip 2 (which is a odds for an outsider) is increased by at least 10% compared to the opening odds (this is how to read the odds changes in this example, another way of calculating odds changes is already a question of another intermediate calculus, the principle of the counting is identical).

For the next lines (at the same level, so for the new lines we only use the PLUS button, not +++), we will gradually write three additional conditions:

.. 3rd row: odds for a favorite is lower for at least 10% compared to the opening odds,

.. 4th row: odds for a favotire is higher for up to 10% compared to the average odds,

.. 5th row: odds for an outsider is higher for at least 15% compared to the average odds.

Thus, the condition for the first situation (branch) is fully written and we can move to the second branch.

This is done by selecting the first line and pressing the PLUS button (a new row is created at the same level). We put there the function OR (see above). The situation after adding a new line and writing OR is also shown in the figure above.

Then we can write down all conditions for the second situation. They are similar to the first branch, but for the opposite odds (home / guest):

When testing a defined filter, we find that the written conditions are very strict and suit the minimum matches. This may be to consider modifying the filter and not using current odds from one office, but to the maximum listed odds from all available offices. This can be done by modifying the Filter / Column, where the "Odds Level" section of the filter is available.

Here are the matches returned by our filter:

Here's a match with the detail odds list:

This is so much a demonstration of working with the odds in the filters. For example, you can expand your odds with up to three other bookmakers: using the sections at the Filter / Odds area: Odds I, Odds II and Odds III (you can select a different bookmaker there and then work with those values at Filter / Columns).