Backing on home team if away team won in half time

Here's its concept: if one of the teams in a basketball game (or any other game that implies half time) has won in the half time, then back on the other team in "Match Odds".

There are several markets available for betting on BetFair for each basketball game. Two of them are called "Match Odds" and "Half Time Match Odds". To determine the winner of the half time one can use the following methods:

Wait till "Half Time Match Odds" is settled. Can take indefinite time.

Wait till the favourite's lay price becomes 1.01 (or its back price 1.01 and lay price - something within 3-5 ticks from 1.01). This method does not require waiting, but it still gives truthful results.

This example utilises the second method. It monitors the market called "Half Time Match Odds" and waits till any selection's price drops to 1.01. Then it remembers that selection. Once that's happened, the second trigger looks for a team in "Match Odds" whose index (position in the list of teams) is different from the index of the remembered team. In other words, it bets on the opposite team.

The first trigger in the file finds and remembers the team that has won the half time. The name under which the team is remembered contains a trigger variable market_parent_id which returns the ID of the game to which the market belongs. The other market, "Mach Odds", belongs to the same game, that is why you can address that variable in both markets expecting it to have the same value for both of them.

The second trigger places a bet as soon as the first one has set the variable nba_market_parent_id. It compares two teams' indices and bets on that one whose index is not equal to the index of the remembered team.