Horse racing in-play bot
Posted in From My Inbox by StefanBelo
I want the bot to bet $5 on the first horse to reach 2.0 in the in-play market: might be the favourite, might not be.
To execute such strategy you need to setup the bot criteria using the Bot Executor and its Bot Criteria editor. Open the Bot Executor (View/Bot Executor) and click on the toolbar button: Add a new bot criteria.

As you want to place bet only you have to use Place bet bot with following parameters:
| Parameter | Value |
|---|---|
| BetType | Back |
| MinOdds | 1.5 |
| MaxOdds | 2.0 |
| AllowPlacingBetInPlay | True |
| AtInPlayKeepBet | False |
| PlaceBetAtOdds | False |
| PlaceBetOnRunner | 1 |
| Stake | 5.0 |
| StakeIsMyLiability | False |
| StakeIsPercentageOfAvailableBalance | False |
| StartFromTime | 00:00:00 |
| StartFromTimeEnabled | True |
On the Market Criteria page switch on: Sort selections by - Probability to win

On the Selection Criteria page add criteria BestOdds Back <= 2 applied for runner: 1

If you run such bot on selected market the bot will be executed at the official start evaluating the favorite at the moment if its best offered back odds is <= 2.0. If the favorite is traded at odds 2.0 the place bet bot is executed placing the back bet on the favorite selection.
As you can see it is not possible to run this bot exactly at the moment when market is turned at in-play, but you can run it manually using the bot executor. It does not matter on which selection you run this bot as the bot will check and place the bet only on the favorite.
You can use this bot criteria setting with the Trade opportunity lookup service (TOLS) to run the bot automatically on more markets. You can set the start time for the TOLS into the minus values.
You can run this bot also with the tool: Execute my strategy on my selections.
Friday, January 23, 2009
My test in the practice mode
When you run this bot at in-play you will see that bot will wait for aby horse to fulfill the Selection Criteria: Best odds for Back <= 2.0 then will fire bet placing on such horse.
For users which use AM/PM time format, please change your computer time format settings to 24 hours, so you will be able to set: 00:00:00, what is not possible with AM/PM format. I will see how I could fix this problem.
Tuesday, January 27, 2009
Trailing Stop Loss instead of % of liability
Hi Stefan,
Thanks for your earlier post about the ability to set the bot for certain triggers with 'in running' horse races. I have been using your example to 'place bet and close position' and it works okay but 2 times out of 10 the back bet is taken but then the market changes, price goes right out which activates the stop loss.
The problem is that when the stop loss is activated and 'reds up' the field, the original lay bet that was set to close the position remains uncancelled - so the question is can the first lay bet be cancelled once the stop loss has already 'redded up'? Twice the horse went out, came back in to win and I've layed it twice!
Whilt discussing stop losses, it would be very interesting to see if you can add another tool/option. Currently the stop loss setting is only as a percentage of the liability. This means it will only activate when the bet is losing and in the 'red'. What would be a great addition to the software is to see a 'trailing stop-loss' so that if the market changes direction after your intitial back is taken you have the option to cut losses after a predetermined number of ticks instead of using a % liability.
The biggest advantage I can see would be that even when you are in a green situation and yet the market moves the wrong way, the bot can recognise this and close the position.
For example:
You have set the bot to place bet and close position: Back between 2.10 and 2.00, close position after 30 ticks. The horse is doing well and the market brings the horses price beyond 2.10, the bot gets matched at 2.00. The price continues to come in and we are in a green position as the price is 1.75 but then the price moves backwards. To close out at 30 ticks the lay bet doesnt look like it will be matched and as the price drifts out, all that can stop it is the stop loss % liability. A trailing stop loss could be set that so if ever the price goes the 'wrong' way for 10-15 ticks or more to close the position. This would mean in this example, once the price changed direction at 1.75 the bot could then close out the position at 1.85 locking in a 15 tick gain.
Apologies if you already have such a feature and I havent seen it but if you could see if this is something that could be added to the stop loss facility I think this could help protect stakes better in the long run and increase profits for those who wish to pursue this line of trading.
Many thanks in advance for your time and if it can be done I sure can't wait to use it.
Keep up the good woork,
Chris
Tuesday, January 27, 2009
Hi Chris, When a bot executes stop loss and there are some unmatched bets on the selection before placing the stop loss bet all unmatched bets are canceled first.
You maybe set parameter RepeatTradingCycle to true and then the bot reentered into the market, if odds range was set from 1.01 to 1000, the bot placed opening bet immediately. I cannot see any problem with the bot code.
When you use RepeatTradingCycle, you should set the IncreaseProfit parameter too.
I made some bespoke solutions where the trailing stop loss was used, I will see if I can prepare simple trading bot with this feature as I do not want to add any new features into the existing bots.
Tuesday, January 27, 2009
You're right, sorry Stefan, I did have it on repeat trading cycle.
Yes please! If you could prepare a simple trading bot with the trailing stop loss feature I believe it would be of great use.
All the best
Chris
Saturday, January 31, 2009
Chris, I have just added a bot tutorial: "Betfair bot programming: trailing stop loss" into the Bfexplorer Labs, so if you are interested you can read about bot programming or test this bot in your strategies.
Tuesday, February 03, 2009
Thanks Stefan, I shall give it a go!
Many thanks
Chris