• Hi Guest Just in case you were not aware I wanted to highlight that you can now get a free 7 day trial of Horseracebase here.
    We have a lot of members who are existing users of Horseracebase so help is always available if needed, as well as dedicated section of the fourm here.
    Best Wishes
    AR

AI Strategy

StefanBelo

Yearling
What do you think about this kind of strategy?

# Horse Racing EV Analysis - Favourite R9 Silent
## 1. Core Strategy & Data
**Objective**: Analyze the entire field to execute trades ONLY on the favourite horse. BACK strong favourites, LAY weak ones, and take NO ACTION otherwise. All analysis is performed silently, with a report generated only upon execution.
**Data Retrieval & Validation**:
1. **Get Market**: Use `GetActiveBetfairMarket` to get the active market and selections.
2. **Get Horse Data**: Use `GetAllDataContextForBetfairMarket` with `['TimeformDataForHorsesInfo', 'RacingpostDataForHorsesInfo']`.
3. **Validation**: Proceed only if data completeness is ≥80% for all horses.
**Configuration**:
- `generateEVReport`: `true` (default) or `false`.
- `evReportFormat`: `"table"` (default) or `"json"`.
## 2. Analysis & Scoring Framework
**Semantic Analysis**:
- Analyze race history (up to 6 races) to identify performance evolution.
- Compare recent (last 3) vs. historical (previous 3) races to score evolution from **Strong Improvement (+6)** to **Strong Decline (-5)**.
- Contextual factors include race class, distance, ground, and field strength.
**Combined Horse Score (100 points total)**:
- **Base Rating (35%)**: Timeform Stars and RP Rating.
- **Enhanced Form & Evolution (40%)**: Recent wins, form flags (`horseWinnerLastTimeOut`, `horseInForm`), and the performance evolution score.
- **Suitability (15%)**: `suitedByGoing/Course/Distance`.
- **Connections (10%)**: Trainer and jockey form (`trainerInForm`, `jockeyInForm`).
## 3. Field Analysis & EV Calculation
**Field Position Metrics**:
- **Favourite Dominance Score**: Favourite's score vs. the field average.
- **Quality Threats**: Count of horses with a score ≥70.
- **Field Strength Category**: Classify the favourite's position from **DOMINANT** (≥20 points above avg) to **WEAK** (<5 points above avg).
**EV Calculation**:
1. **True Probability**: Derived from normalized horse scores.
2. **Implied Probability**: `1 / Decimal Odds`.
3. **EV Formula**: `((TrueProb - ImpProb) / ImpProb) * 100`.
4. **Dynamic Adjustments**: Apply multipliers based on horse quality, field strength, opposition threat, and performance evolution.
## 4. Execution Logic & Reporting
**Decision Logic**:
- **Identify Favourite**: The horse with the lowest decimal odds.
- **Field-Relative EV Thresholds**: Use stricter EV thresholds for weaker favourites.
- **DOMINANT Favourite**: BACK ≥+3%, LAY ≤-10%
- **STRONG Favourite**: BACK ≥+5%, LAY ≤-8%
- **MODERATE Favourite**: BACK ≥+7%, LAY ≤-6%
- **VULNERABLE Favourite**: BACK ≥+10%, LAY ≤-4%
- **WEAK Favourite**: BACK ≥+12%, LAY ≤-2%
- **Execution Criteria**:
- **BACK**: Positive EV, DOMINANT/STRONG field position, positive form/evolution.
- **LAY**: Negative EV, VULNERABLE/WEAK field position, declining/erratic evolution.
- **NO ACTION**: Unclear value, high data uncertainty, or conflicting signals.
**Execution Commands**:
- **BACK**: `ExecuteBfexplorerStrategySettings(marketId, favouriteSelectionId, "Bet 10 Euro")`
- **LAY**: `ExecuteBfexplorerStrategySettings(marketId, favouriteSelectionId, "Lay 10 Euro")`
**Reporting**:
1. **Execution Report**: A single-line summary is generated upon execution.
```
STRATEGY_EXECUTED: [BACK/LAY] [Horse_Name] at [Odds] - EV: [XX.X]% - Field: [DOMINANT/STRONG/etc]
```
2. **EV Report (Conditional)**: If `generateEVReport` is `true`, a detailed report (markdown table or JSON) for all horses is generated after execution, providing a full breakdown of the analysis that informed the favourite-only decision.
**Error Handling**:
- If data is incomplete (<80%) or a calculation error occurs, default to NO ACTION and log the issue internally.
 
Logic sounds good for a Betfair bot.

View attachment 160657
Have you tried this approach? Which LLMs do you use, if any? A detailed explanation of the prompt is as follows:

Markdown (GitHub flavored):
1. **Retrieve Market Data**: Get active Betfair market ID, selections, and odds.

2. **Fetch Horse Data**: Obtain Timeform and Racing Post data for all horses.

3. **Validate Data**: Proceed if ≥80% data completeness; else, NO ACTION.

4. **Score Horses**: Calculate 100-point scores for all horses (base rating, form/evolution, suitability, connections).

5. **Assess Field Strength**: Classify favourite's position (DOMINANT to WEAK) vs. field average and threats.

6. **Calculate Favourite EV**: Derive true probability from scores, implied from odds, compute EV with adjustments.

7. **Decide Action**: Based on field category and EV thresholds (e.g., DOMINANT BACK ≥+3%, LAY ≤-10%), choose BACK, LAY, or NO ACTION.

8. **Execute Strategy**: If BACK/LAY, run `ExecuteBfexplorerStrategySettings` with "Bet 10 Euro" or "Lay 10 Euro".

9. **Report**: Output execution summary and optional EV table for all horses.
 
Well i think it makes sense as if you where concentrating on the fav you already know that a third win and two thirds dont but the more you analysed what the fav is likely to do against the field you would get better and better at seeing what a fav needs to win and get better at one solid action.
 
Have you tried this approach? Which LLMs do you use, if any? A detailed explanation of the prompt is as follows:

To be fair, I am a novice at any sort of coding and applaud any idea, like yours, to test the market and find an edge.

The only way I broke down your initial script was to ask GPT to analyse it. It said "It's a really well-structured strategy outline."

So I asked it to create a dummy race. We all know GPT sometimes goes off half-cocked, so it's likely it lost something in translation, although it did "think" for a whole 3 minutes 5 seconds, enough time for me to put the kettle on and have a whizz.

---

After thinking for 3 minutes 5 seconds, it came up with a this: I suppose, if the favourite of the race is top-rated and is E.V then you're cooking.

1) Quick scoring method​

Totals are out of 100 with these weights:
  • Base Rating (35 pts) — Timeform stars (1–5) + RP rating (field-normalised).
  • Enhanced Form & Evolution (40 pts) — recent wins (0–3), winner-last-time / in-form flags, plus evolution (mapped from −5..+6 → 0..16 pts).
  • Suitability (15 pts) — 5 pts each for going / course / distance fit.
  • Connections (10 pts) — 5 pts trainer in-form + 5 pts jockey in-for
    True probability = each horse’s score ÷ total field score (normalized).
    Implied probability = 1 ÷ decimal odds.
    Raw EV% = ((TrueProb − ImpliedProb) / ImpliedProb) × 100.
    Then I apply a conservative dynamic multiplier (small adjustments based on horse quality, field strength, opposition threat & evolution) to get Adjusted EV%.

1759485082413.png

1759485172940.png

1759485204857.png

1759485228118.png

-----
 
Perhaps Concentrate on past races that have a high strike rates for favourites winning

You could try running this race through your AI software to see if it agree on an investment

IMG_4442.jpeg
Mares Hurdle 2m 4f

Adela Icon (Brian Hayes) disappointed over 2m 4f at Listowel but we think she will leave that form behind over this shorter trip. She had previously been a decisive winner over 2m 1f at Bellewstown and a first-time tongue strap should be a big help. We are expecting her to get back to winning ways.
 
Last edited:
Re the above at present has been flipped as Favourite , might change but would not qualify if 2nd Fav
 
Perhaps Concentrate on past races that have a high strike rates for favourites winning

You could try running this race through your AI software to see if it agree on an investment

View attachment 160683
Mares Hurdle 2m 4f

Adela Icon (Brian Hayes) disappointed over 2m 4f at Listowel but we think she will leave that form behind over this shorter trip. She had previously been a decisive winner over 2m 1f at Bellewstown and a first-time tongue strap should be a big help. We are expecting her to get back to winning ways.
My approach is a little different; it is not a machine learning strategy. What I am testing is an AI agent workflow using the available data I have for a race.
 
To be fair, I am a novice at any sort of coding and applaud any idea, like yours, to test the market and find an edge.

The only way I broke down your initial script was to ask GPT to analyse it. It said "It's a really well-structured strategy outline."

So I asked it to create a dummy race. We all know GPT sometimes goes off half-cocked, so it's likely it lost something in translation, although it did "think" for a whole 3 minutes 5 seconds, enough time for me to put the kettle on and have a whizz.

---

After thinking for 3 minutes 5 seconds, it came up with a this: I suppose, if the favourite of the race is top-rated and is E.V then you're cooking.

1) Quick scoring method​

Totals are out of 100 with these weights:
  • Base Rating (35 pts) — Timeform stars (1–5) + RP rating (field-normalised).
  • Enhanced Form & Evolution (40 pts) — recent wins (0–3), winner-last-time / in-form flags, plus evolution (mapped from −5..+6 → 0..16 pts).
  • Suitability (15 pts) — 5 pts each for going / course / distance fit.
  • Connections (10 pts) — 5 pts trainer in-form + 5 pts jockey in-for
    True probability = each horse’s score ÷ total field score (normalized).
    Implied probability = 1 ÷ decimal odds.
    Raw EV% = ((TrueProb − ImpliedProb) / ImpliedProb) × 100.
    Then I apply a conservative dynamic multiplier (small adjustments based on horse quality, field strength, opposition threat & evolution) to get Adjusted EV%.

View attachment 160678

View attachment 160679

View attachment 160680

View attachment 160681

-----
Yes, exactly that is the way my AI agent strategy works. Having the Betfair market, the AI retrieves data for this market/race, analyzes it, calculates the EV, and then makes a decision. A bet is placed on Betfair if the strategy triggers bet placement.
 
Well i think it makes sense as if you where concentrating on the fav you already know that a third win and two thirds dont but the more you analysed what the fav is likely to do against the field you would get better and better at seeing what a fav needs to win and get better at one solid action.
Thanks! I will try to create a prompt for such a strategy. First, I need to learn how an LLM could evaluate data. Fortunately, my advantage is that I am a software developer, so I can code it as well. However, for now, my priority is to determine whether the AI agent approach has any value.
 
1759513739399.png

It works something like this: the black console represents the AI agent executing the prompt, while the white one represents my agentic app.

So, no coding is required, as the AI agent only executes the prompt with the help of an agentic-ready app. This approach is very useful for testing strategy ideas, which can later be ported to machine learning and bot strategy code. While AI agents might cost a little money, there are many available for free with a limited number of queries for testing.

I now know that DuckandDive DuckandDive has some experience with LLMs, but are there any other Betfair-ians here?
 
I'm carrying out a test of

📈 Layered Strategy – Profit/Loss Over Time (Day 1 to Day 8)


Tracking simulated cumulative returns using Fairbot in-play model

In fact, I've just posted the results for Day 8.

I use LLMs - OpenAI, GPT 5. GPT 4.oh, and straightforward prompts that can be used in the free & £20 per month versions.

In the last race of the day, Lady Of Arabia was the pick, and came 3rd and paid out twice 3tbp and 4tbp.

Things are ticking along nicely, and I hope for a positive outcome after the 10-day simulation test period.

I am looking very closely at AI Agents and might switch over in the future.

Good work and best of luck.

Jack
 
21:00 Santa Anita (3TBP market), here's a refined and data-driven reassessment of betting angles, specifically tailored for this low-equity, volatile market. REAL MONEY BETS, not simulation Layered Strategy Testing tonight!


Betfair exchange odds are always net of stake, meaning profits are listed separately from the stake return.

🧾 Corrected Bet Return Summary​


SelectionMarketOddsStake (£)Profit (£)Total Return (£)
Latte LuvWin9.80£1.60£14.08£15.68 (£14.08 + £1.60)
Tiz GraceWin7.80£2.40-£2.40£0.00
Tiz Grace3TBP2.44£1.65£2.38£4.03 (£2.38 + £1.65)
Latte Luv3TBP3.00£1.35£2.70£4.05 (£2.70 + £1.35)
1pt = £1


✅ Totals:​

  • Total Stake: £6.95
  • Total Profit: £16.76
  • Total Return: £23.71
    (Profit + Stake returned)
I've really missed the added frisson/tension of real money betting for the last 8 days. UK Layered Strategy Testing has 2 days left to run.

Suggested Prompts to use for another race:

Next race, same deal. (about 10 minutes before off time - watch the TV coverage)

Paste the full BF fully opened exchange win market.
Paste just the 3 TBP market (I have both open in separate tabs with the GPT tab in the middle)


2nd prompt if needed: (about 3 minutes before off time - watch the TV coverage to ensure you get near the post time)

BF odds nearer post time use for a reassessment of the Recommended Betting Angles

Paste the win and place markets.
 
Last edited:
StefanBelo StefanBelo The old school excel approach, would have captured that one too.

Using an exponential decay ranking model, combined with a model to market combi probability model and a dynamically factored CTW staking efficient optimalisation alogorithm, the outcome is posted below.

Can't claim credit for most of the calculus within the sheet, that was ARAZI91 ARAZI91 in another part of the forum.

1759564709714.png
 
StefanBelo StefanBelo The old school excel approach, would have captured that one too.

Using an exponential decay ranking model, combined with a model to market combi probability model and a dynamically factored CTW staking efficient optimalisation alogorithm, the outcome is posted below.

Can't claim credit for most of the calculus within the sheet, that was ARAZI91 ARAZI91 in another part of the forum.

View attachment 160703
DuckandDive DuckandDive
The "calculus" is the EASY part - building a fully comprehensive handicapping model that enables one to take advantages of mistakes by the betting public and has been statistically proven on back tested and live data .............is the really difficult part. Can take up to a good third of your life and can be a lonely, solitary, obsessive pursuit where the people that once loved you tend to always leave you. Your daughters (or sons) better be the forgiving types (for you to have any sort of relationship).
 
The "calculus" is the EASY part - building a fully comprehensive handicapping model that enables one to take advantages of mistakes by the betting public and has been statistically proven on back tested and live data .............is the really difficult part.

Ah....that's the fun bit! :crazy:
 
DuckandDive DuckandDive Do you use semantic analysis of race descriptions in your model?

I have used them on one of the other sheets I was testing.

Copy and pasted the Timeform comments into a cell next to the selection (s), then the look up table gives +/- to each positive/negative that appears. Can also use for race comments on each run if rating each form-line.
 
Back
Top