Creating your own custom betfair trading bot

Bfexplorer is not only trading platform for betfair but bot development platform as well. If you are familiar with any .NET programming language you can use Bfexplorer BOT SDK to program your own bot. Well that is nice, but what about a common betfair user who is not a software developer or enthusiast programmer? If your bot can be constructed from existing ones then you can use the bot: Chain execution on selection/market.

For instance if you want to create betfair trading bot that would close bet position in profit by hedging when 2 ticks profit is reached, and close position in 3 ticks loss by NET stake, then you can use following bots: Place bet, Close position, Wait for profit or loss on selection, If profit then else, and Chain execution on selection.

To create this custom betfair trading bot I started with the bot: Close position. Close position bot as the name suggests, closes bet position by hedging or by NET stake, at preset profit or loss targets. This bot closes bet position at preset time as well, and I used this feature setting parameters ClosePositionOnTime to -23:00:00 and ClosePositionOnTimeEnabled to True. So I set the time to 23 hours before official event start time, as we trade just couple minutes before race off, this setting effectively closes bet position at current odds when bot is executed.

I prepared two bot settings:

  • Close position by hedging (HedgingEnable True)
  • Close position by NET stake (HedgingEnable False)

To place the opening back bet I used the bot Place bet, offering my bet at better odds (PlaceBetOnBetterOdds True). I named this bot setting:

  • Back 10 Euro on better odds

I want to create a trading bot, and this bot will be created by using Chain execution on selection bot. Therefore I will need a bot which will trigger a bot to close bet position. In this case a bot which will wait for my profit or loss target, because Chain execution bot executes a next bot in the chain only when the previous one is stopped.

I used the bot Wait for profit or loss on selection and named my bot setting:

  • Wait for 2 ticks profit or 3 ticks loss

To close bet position either by hedging or NET stake depending on current profit I used the bot: If profit then else. I named my bot setting:

  • Close position by hedging or by NET stake

That is the last bot setting I need for my trading bot, and in my bot scenario I have got:

  • Back 10 Euro on better odds
  • Wait for 2 ticks profit or 3 ticks loss
  • Close position by hedging or by NET stake

To execute these bots in chain I used the bot Chain execution on selection. I named my bot setting:

  • My trading bot, 2 ticks backing or 3 ticks loss

And this is the bot I will use. Later in my video you can see how I tested this bot in a profit and in a loss scenario. When testing loss scenario the bot was not closing bet position, because I forgot to set the parameter: ClosePositionOnTimeEnabled to True, so the bot was waiting for profit or loss target, but as I set them to 0, so was waiting for 0 loss bet position to close.

In Chain execution bot I did not set the parameter: SetDataEnabled to true. If you set this parameter, and in Bot Executor you set Auto Start, then you will be able to execute your bot by clicking on ladder. In such case your bot will take BetType, Odds, Stake and StakeIsMyLiability from the ladder setting, so even if I set my trading bot to place back bet as the opening bet, if you would click on the lay column on the ladder the bot would start Lay/Back trading session.

Comments (2)

  1. Says:
    Sunday, August 07, 2011

    Ty videa jsou bezvadné, výborně ukázáno spojování botů, myslím, že takto to pochopí skoro každý, zvláště když si může videa pozastavit, zkontolovat nastavení jednotlivých botů, prostě takto se mi to líbí!

  2. max Says:
    Thursday, August 11, 2011

    This video is very useful for me and allowed me to understand how working bot Wait for profit or loss on selection. Previously, it seemed to me that this bot is just waiting for set profit or loss and close position so I did not use it because it's that I used other bots. This bot waiting until the condition Profit or Loss and then starts another bot, and it is very good.

Do you want to comment this article? Sign up here or login.