How to cancel all unmatched orders on the market/selection by bot?


I need some help.

Heh... It looks like an easy task but I can't figure out how to do that... I need to cancel all unmatched orders on the market/selection.

Also, I've got another question. How to place orders at all selections in the market at once? For example, there are 25 selections(Horse Race) and I want to lay at 1.1 on every selection. I see there's a bot named "Place Bet" but it can only place bets on specific selection so does it mean that I need to make 25 bots for that task?

It would be nice if there was an option that I can tick and make the bot to place the order at all selections at the market.

Any help would be appreciated.


Updated by Stefan:

Here is the video preview of your bot trigger. It offers two parameters LayOdds and LayStake, by default are set to 10.0 @ 1.1 The offset bet as you call it, in bfexplorer terminology Hedge bet is managed by action bot entered by parameter BotName. This approach allows to setup different types of bots for closing a bet position on a selection.

It was not required but depending on the lay odds you enter it could happen that at one moment can be matched lay bets on more than one selection; the bot trigger manages such situations as well.

Download “Horse Racing Trade First Favourite Bot Trigger” script if you want to test it or build your own script from it.

Comments ( 89 )

  • ruipedrosilvasousa
    20.9.2015 13:35:10

    answer to your second question

    select markets, and then click "Start Bot" and select the bot you want to run in the chosen markets..

  • Ilya Nikol
    20.9.2015 13:38:06

    P.S. Also, is it possible to cancel only unmatched Back or Lay order?




  • ruipedrosilvasousa
    20.9.2015 13:47:29

    Sorry i do not know..

    Wait for the response of stefan

  • Mir.
    20.9.2015 15:36:14


    1) Stop Market Monitoring bot can Stop all running bots and Cancel your bets



    2) Place bet on Selections - you have 2 easy way

    A) You can create Place Bet bot for every selection...


    B) You create one Place Bet bot with default settings "Selection", and than create Execite on Selection bot...

    This bot execute any Bot on any Selection you want.

  • Ilya Nikol
    20.9.2015 17:02:58


     Thanks for the help, guys! I really appreciate it!


    But I still can't figure out how to cancel only "specific" unmatched bets, for example, only unmatched Back bets or only unmatched Lay orders.  


    Also, I can't figure out how to make the bots to start work again on the market after I triggered "StopRunningBot" bot.


  • Mir.
    20.9.2015 17:47:48

    Ilya Nikol,

    if you are manual trader you can cancel bets:

    - on the Ladder (click column header - To Lay, To Back)

    - in the Market Bets (select curent bet and cancel)


    If you are trader with full automated solution, you must know which bets are on the selection or market. If there are Open bets or Close bets, never mind if bets are with Lay or Back type.


    Or ... in other words: you must cancel Lay bets if your Open bet is Lay bet and full matched? No.

    I expect that you have only Close bet on the Selection, with Back bet type.


    I understand your requirement, but it not need actually.

  • Ilya Nikol
    20.9.2015 18:01:57


    Mir, can you help me how to do that:


    For example, there are 25 selections in the market and I place a Lay order at price 1.1 on every selections and if any of these order is matches then I want to place offset "Back" order on that selection and cancel all other unmatched lay orders.  


    Thanks for any help.


  • Mir.
    20.9.2015 18:45:16

    Yes, I understand.

    Trouble is when the first bet matched. Next bot in Chain execution (Stop Market monitoring with StopRunningBot parameter) close ALL OTHER BOTS. In this case if close Chain execution bot will not run next others...



    I asked a similar question. Answer is here: the bot

  • Stefan
    20.9.2015 18:59:19

    Miro’s suggestion is wrong.

    If you want to place a bet on all selections then you must create Place bet bot setting with set Odds parameter to 1.1 and the parameter PlaceBetInAllowedOddsRange to False (uncheck parameter), the parameter ExecuteOnSelection must be set to 0, only in such case you will get a general bot settings which can be executed on any selection.

    It is clear that you need to set BetType to Lay, and Stake.

    Now, you can use this general bot setting, you named it for instance Place lay bet 100 @ 1.1 with the bot Execute on Selections.

    People please, read descriptions for bot parameters. What does the “Execute on Selections” bot parameter OnSelections say?

    Selections on which you want to execute your bot (for instance: 1,2,4). If you do not type any selections the action bot will be execute on all selections.

    So if you want to execute your action bot (Place lay bet 100 @ 1.1) on all selections, then just leave this parameter empty, once again read:

    If you do not type any selections the action bot will be executed on all selections.

    Place bet and close selection bet position, is the bot placing offset bet as you name it Ilya. In bfexplorer terminology we call such operation Close selection bet position, or hedge bet position.
    What you want to achieve can be done by custom bot trigger only, you actually develop a trading strategy.

    For now you can use Place bet and close selection bet position, and execute such bot as suggested on all selections, so once your lay bet is fully matched the bot places back bet at set Profit parameter. I think you already figured out that placing “offset bet” immmediatly after opening bet is matched you need to set the parameter: ClosePositionImmediately.

    When using other betfair apps you need to do such development mainly by creating Excel triggers, and when necessary by programming some VBA code in excel, here in bfexplorer you can do so by bot trigger programming.

    All bfexplorer bots offer some base functionality, if you already tested Place bet bot with your settings you might notice that executed bot remains active till its action is not finished. This feature allows combine some base bots in a simple solution.

    In your trading solution you need:

    Place bets

    Monitor bet status to execute bets cancelling and closing bet position on selection with matched bet.

    Close bet position bot is available, but not bot for canceling other bets. I will think about it, if making some other simpler bots will benefit others.

  • Ilya Nikol
    20.9.2015 19:57:53


    Once more, thanks for your help and patience, guys!


    I already figure out how to place the offset order when the initial order is matches and how to execute bot on all selections and I liked it very much!


    It's very impressive that such complex task can be done so easily in BFexplorer! My hat's off to Stefan!


    The only issued I have is that I can't figure out how to cancel the unmatched bet orders on specific selection when the order is matches on some selections.