Strategy Edit

How To Configure The Criteria Of A Strategy

To open the configuration panel, double-click on the strategy from Strategies Window, or right-click the strategy → Edit.

Important Advice

It's important to be cautious when inputting values in the criteria of a strategy. If the bet triggering logic is not set up properly, the strategy could quickly use up the allocated capital and place unwanted bets. To minimize the risk, it's advisable to take the following steps:

1) Read the instructions on this page before modifying any strategies.
2) To minimize risk, start with a low Initial Capital when developing and testing new strategies.
3) Take some time to study the example strategies included with the program, as they have been thoroughly tested in various scenarios. You may find that the strategy you want to implement is similar to one of the examples, in which case you can use it as a starting point.

How strategies work

Ipposnif updates market data based on customizable rules, which can be adjusted in the Options.
During each market update, the strategies' criteria are assessed against all runners in the updated market.
A strategy places a bet and creates a trade when its bet placement conditions are met. The trade is an instance of the strategy and can contain a minimum of one bet (betting strategies), or more than one (trading strategies). Once a trade is created, a counter criteria prevents the creation of new trades in the same market.
Below, you will find criteria designed to limit the number of trades, markets, and runners active at any given time.
With these criteria in place, you can implement strategies that play across multiple markets and runners, such as Auto - Outsiders LAY, as well as strategies that use progressions and can have only one open bet at one time because they require knowledge of the previous outcome before placing a new bet (for ex. Auto - Chase Losses BACK).

Ipposnif uses the following criteria types.
  • SQL Expression: with SQL expressions you can define amounts, to specify for example the bet size, or the bet price. Plus prefix (+) means that the expression must return a positive amount.
  • SQL Assertion: an SQL expression that can be true or false. They are used as conditions for the bet placement, or to trig other events.
  • String: a combination of the following characters:
    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 
    a b c d e f g h i j k l m n o p q r s t u v w x y z 
    _ + - 0 1 2 3 4 5 6 7 8 9 ^ * # @ . , ° [ ] ( ) ! \ 
    | / ? : $ € £ % {space}
  • Integer: an integer number. Plus prefix (+) means that the number must be positive.
  • Time: time of the day expressed with the 24H format hh:mm:ss (for ex. 15:05:00).
  • Timeframe: time frame related to the start time of the event. It is expressed with the 24H format hh:mm:ss. If negative, it is subtracted from the related event start time.

Properties marked with a star (*) are mandatory.

Identification

ID* (+integer): it is automatically assigned to every new strategy.
Name* (string): unique name of the strategy.
Group Name (string): you can group strategies together giving them the same Group Name. This will allow statistics for groups of strategies.
Description (string): description of the strategy.

Capital

Initial Capital* (+SQL Expression): is the bankroll of the strategy, the maximum amount of money the strategy can lose. If not differently needed, use a number to specify the capital.
You can read the value of the initial capital from the other strategy's criteria using the variable
@initial_capital.
You can read the value of the actual capital (Initial Capital + Net P&L) using the variable @capital.
If you have a group of strategies and you want to use a common multiplier for their stakes, you can use here one of the global variables.
If the strategy works with rounds (read below) and you want to reinvest part of the previous rounds winnings, you can use the variable @last_reset_historical_profit
If you choose to use an SQL expression to set the Initial Capital, make sure that the returned value is within your control, or it could put your entire Betfair balance at risk.
Max Liability (+SQL Expression): maximum responsability the strategy can have.
Daily Stop Loss (+SQL Expression): When the strategy has a net loss, in the current day, greater than this amount, it stops placing bets until the day after. The local timezone is applied. Only settled bets are counted. All trades from all rounds are counted (even if the Reset functionality is active).
Daily Stop Win (+SQL Expression): when the strategy has won in the current day more than this amount, it stops placing bets until the day after. The local timezone is applied. Only settled bets are counted. All trades from all rounds are counted (even if the Reset functionality is active).
Max Reset (+Integer): maximum number of times the strategy can perform a reset. When the strategy resets, it start a new round with a new capital. Zero means no reset. The total amount of money risked by the strategy is equal to: Initial_Capital*(MaxReset+1).
Reset Condition (SQL Assertion): when the SQL assertion is true, and all the trades are settled, the strategy is reset. The reset conditions are checked asyncronously every 15 seconds. If you want to reset a strategy before it has finished its capital, or a progression before it has been completed, in this strategy you need to wait at least 15 seconds before placing a new bet, because the placement of a new bet would prevent the strategy from being reset. @last_check_bet_seconds is a variable that can be used for this scope.
Max Active Markets* (+integer): maximum number of markets with open and closed trades. If you are using a progression that requires to know the previous outcome before placing a new bet, this value must be 1.

A trade can have one of the following statuses:
  • O = Open. A trade starts with this status when it is created, and remains open until one of the bets closes it.
  • C = Closed. When a trade is closed it cannot receive more bets. If the strategy can manage more trades on the same runner, but only one open at one time, close the trade to start a new one.
  • X = Deleted. When a bet is deleted, if it was the only present in the trade, the trade is deleted too. A trade containing a matched bet cannot be deleted.
  • S = Settled. All the bets inside the trade have been accounted after market is settled.
Trades per Market: can be one of the following options:
  • Single trade per market: maximum one trade per market.
  • Single trade per runner: maximum one trade per runner, for a maximum of Max Runners.
  • Multiple trades one runner: a maximum of Max Trades on only one runner.
  • Multiple trades and runners: multiple trades on a maximum of Max Runners. Only one trade open at one time for the same runner.
  • Unlimited: no limit applied. Use the Trigger Condition criteria to limit the number of bets.
Count Deleted Trades: when this option is checked, deleted trades (that have only deleted bet inside) are considered for the "Trades per Market" limit. This option is useful if we don't want to attempt a new trade in the same market, if the first one was deleted.

Link To Another Strategy

Makes the current strategy dependent from another one.
Strategy: linked strategy.
Criteria: when the criteria applied to the linked strategy is true, the current strategy can place bets. The following link criteria can be used:
  • Day PL greater/less than the specified amount
  • Market PL greater/less than the specified amount
  • Market total trades equals to the specified amount
  • Consecutive won trades equals/greater than the specified amount
  • Consecutive lost trades equals/greater than the specified amount
  • Consecutive won reset equals/greater than the specified amount
  • Consecutive lost reset equals/greater than the specified amount
Amount: amount for the criteria.

Manual Input

Manual strategies require an input from the user before placing bets.
Manual Trigger: the bet placement conditions are checked, immediately and only, after an input from the user. This option speeds up manual strategies and reduces the load of the system. This option cannot be used in scheduling strategies (for example in the strategy Schedule - BACK My Selections where the user selects the runners to bet, but the strategy places the bets only at 1 minute at the start).
Market Checkbox: shows a checkbox near the Strategy Selector. The checkbox can have a different value for each combination market-strategy. You can read this value from the strategy's criteria using the variable @is_market_selected.
Strategies - market checkbox

Runner Checkbox: shows a checkbox for each runner. The checkbox can have a different value for each combination market-strategy-runner.
You can read this value from the strategy's criteria using the variable @is_horse_selected.
Strategies - runner checkbox

Show All Runners Checkbox: shows a checkbox on the header of the runners grid. When this checkbox is checked, all the runners checkboxes are checked too. This checkbox has no variable associated, instead you have to use the variable @is_horse_selected of each runner.
Strategies - all runners checkbox

Price/Size Controls: activate betting frames. It can be one of the following options:
  • None: no betting frame is shown.
  • Show Betting Frames: show BACK/LAY betting frames when the user clicks on a price of the Runners Grid (for example in the strategy Manual - Free Hand). You can read from here how to use the betting frames.
  • Show Price Input Frame: show a new column in the Runners Grid where the user can input a decimal value for each horse. You can read the value from the strategy's criteria using the variable @input_price.
  • Show All Frames: option 2 + option 3.
  • Single Click Price Selection: enable the single click bet mode in the Runners Grid (for example in the strategy Manual - One Click Bet).
@is_event_selected
With a right-click on the Events Grid header, you can make visibile the checkboxes column "Selected".
You can read the value of the checkbox from the strategy's criteria, using the variable @is_event_selected.
The value of the checkbox is the same for all the markets included in the event, so in the strategies using it, you need to specify on which market type you want to bet on.

Market Filters

Event Type, Market Types, Countries, and Racecourses: filters applied to the downloaded markets. These filters will not affect the markets download configuration that you can set up from the options. For international events (like for ex. UEFA Champions League) use “International” as country.
Event Start Time (Time): daily time frame (from start time to end time) when the strategy can place bets. The time format is hh:mm:ss. Specify your timezone in Tmz to use your local time.
Status: status of the market when the strategy is allowed to place bets. Pre means pre-race (before the race goes in-play).
Betting Time Frame (Timeframe): time frame relative to the start of the event, when the strategy can place bets. A negative value means before the scheduled start time of the race, a positive value means after the start time. So for example the values -00:00:10 and 00:02:00 mean that the strategy can place bets only from ten seconds at the programmed start time of the race, to two minutes after the programmed start time (the race has no more delay than 2 minutes).
If the previous option (Status) is "In-Play" the bounds are referred to the moment in which the event goes in-play, and both the values must be positive.
The "Betting Time" values are not mandatory, but it is strongly recommended to specify them to reduce the load of the system, and to avoid that all the markets are eligible for betting at the same time.
Overround Back (+integer): min and max back overround allowed. The overround is an indicator on how much fair are the odds in a market. Closer is the overround to 100 better are the odds for the final user. When the overround limits are applied to a market with more than one winner (like the horse race PLACE markets), the limits are multiplied by the number of winners (during check of the strategy's conditions). The overround back is calculated with the formula: SUM_FOR_ALL_RUNNERS(1/runner_best_back_price)*100
Overround Lay (+integer): min and max lay overround allowed. This indicator is the same of the previous one, but calculated using the best lay price.
Each Bet: if checked, the overround filters are applied to all the bets; if not checked, the overround filters are applied only to the entry bet of the trade.
Only Markets That Go In-Play: only markets that allow betting after the event start.
Only Manually Selected Markets: when this option is checked, the strategy will place bets only on selected markets. To select markets, first you have to show the market checkbox activating the manual input option "Market Checkbox".

Runner Filters

Runner Selection Criteria: criteria used to select the runner/s to bet. If can be one of the following options:
  • None: the selection of the runners is demanded to all the other filters of the strategy (particularly the Trigger Condition of the entry bet).
  • SQL Assertion: the strategy will place bet only when this assertion is true.
  • Red|Blue Flag: the strategy can place bets only on runners with a red/blue flag.
  • Runner Note (LIKE): the strategy can place bets on a runner if its note contains the text specified in Text to search. To perform a like comparison use the % symbol. For example, inserting "%lead%" as text, the strategy will place bets only if the runner note contains anywhere the text "lead".
  • Recent Form (LIKE): the string of the last results can be used to filter runners. For example, inserting "%1" as Text to search, only the runners that have won the last race can be bet; inserting "%11" only the runners that have won the last two races.
  • Runner|Jockey|Trainer|Owner Name (IN): the strategy can place bets on a runner if its name is one in the comma separated list specified. For example, inserting "The Draw" as text, the strategy will place bets only on selections with name "The Draw".
  • Manual Check: The strategy will place bets only on the selected runners. To show the runner checkboxes, activate the option in "Manual Input" section.
Runner Order Criteria: when the strategy criteria produce two or more runners, the runners to bet are ordered by the specified criteria. Desc means "descending order".
Back/Lay Price Range defines the odd bounds within a bet can be placed. These bounds not necessarily set a constraint to the final price of a bet, because the bet price could be updated after the creation (if specified in the strategy). If you need to set bet price bounds that can never be overcome, use the Price Offset criteria.
If you run several strategies at the same time, the use of the criteria 'Back/Lay Price Range', and the criteria 'Betting Time Frame', can considerably reduce the load of the system because their validity is checked prior to the other conditions.

Bets

The maximum number of bets present in a trade is specified by the dropdown "Total Bets". A trade can contain a minimum of 1 bet and a maximum of 20 bets. The placement of a bet within a trade can never be repeated. When a bet is deleted, if it was the only present in the trade, the trade is deleted too.
Use the arrow buttons to move between the properties of each bet.

Only Bet 1 Starts Trade If you have more than one bet per trade, you can decide if only the bet 1 can open the trade (when all the strategy criteria and the trigger condition of bet 1 are verified), or every bet can open the trade (when all the strategy criteria and the trigger condition of the bet X are verified). To place, at one time, a set of bets at different prices, leave checked this option.

Trigger Condition: when the SQL assertion specified is true, the strategy can place the bet, when it is false the strategy cannot place the bet. This condition is optional and it is added to all the other filtering criteria of the strategy.

Order Type: order type of the current bet.
  • Limit: this is the standard Betfair order. User can delete unmatched bets. User can hedge matched bets.
  • SP Market On Close: The bet will be matched when the market goes in-play, at the BSP reconciliation price. Size of the bet is expressed as liability. User cannot delete the SP bets after they have been placed on the market. User can hedge a bet only when it is matched after the market goes in-play.
  • SP Limit On Close: like the order above, but in this case the user can specify a limit for the BSP price: if the BSP is under (over for LAY bets) the specified limit, the bet is voided. User can hedge a bet only when it is matched after the market goes in-play.
Bid Type: bid type of the current bet.
  • BACK/LAY: the bet is of the specified type.
  • Size Sign: type depends by the sign of the bet size. If it is positive the bet type is BACK, if it is negative the bet type is LAY. This option is normally used together with the Manual Input option "Show Betting Frames": the Size returned by the Betting Frame is a negative value if the bet type is LAY.
  • Hedge: the bet will perform a cash out of the current trade balance and the type of the bet will be set accordingly.
Persistence: behavior of the bet when the event starts, it can be:
  • Lapse: the unmatched bet will be voided
  • Persist: if the market goes in play, the unmatched bet will be kept in-play.
  • Market_on_close: bet will be matched at the Starting Price. The Starting Price is calculated by Betfair conciliating all the "Market on close" and the SP bet requests from all the users.
  • Manual Input: the user decides the persistence from the betting frame. This option is present only when the option "Show Betting Frame" is selected in the section "MANUAL INPUT".
Bet Price defines the price of the bet. It can be:
  • A fixed price
  • The best back/lay increased/decreased by a number of Ticks (integer).
  • The best back/lay increased/decreased by a Percentage (integer).
  • The back/lay price at which a specific Stake Amount (+integer) is fully matched.
  • The average price of the bet Ref.Bet. (+integer) plus Ticks (+integer) of gain.
  • Price at which there is a Percentage (+integer) of gain of the size of bet Ref.Bet. (+integer)
  • Price defined by an SQL Expression.
  • Manual Input: the user decides the price from the betting frame. This option is present only when the option "Show Betting Frame" is selected in the section "MANUAL INPUT".
Price Offset Min/Max (+SQL Expression): the minimum and maximum price that a bet can have. If the price overcomes one of the bounds, it is offset to the bound.
Bet Size (SQL Expression): size of the bet. If the size returned by the expression equals to zero, the bet is not placed. The result of the expression is rounded to two decimals. Strategies that follow a particular stake progression, like for example the strategy Masaniello or D'Alembert, know the next bet size calling specific
SQL Functions. You can customize these functions or add new ones from the Ipposnif database.

Invalid Profit Ratio Correction
On every bet request, Betfair performs a Profit Ratio validation: due to the decimal rounding, if you place a bet with a small size at a low price, the eventual profit could be too much unfair compared to the one calculated without decimal rounding. In this case Betfair refuses the bet. To avoid that strategies remain stuck trying to place these small bets, Ipposnif automatically adjust the price of the bet to the closest valid one. For example if you try to place a 0.01 BACK bet at 1.5, the price will be automatically adjusted to 1.8, that is the minimum allowed for this size.


Small Size Bets
In general, Betfair doesn't like to receive bets so small that in case of a win they would not pay at least 0.01 of fees. For example, bets with a price below 2 and with a size smaller than 0.1 don't pay fees. This kind of bets should be placed only occasionally, like for example on a certain phase of a Masaniello progression. Instead, if you try to gain an hedge sistematically tricking the fees, sooner or later Betfair will discover it and restrict your account. To avoid this kind of issues, the rule of thumb is to place bets with a size of at least 0.20.


Size Offset Min/Max (+SQL Expression): the minimum and maximum size that a bet can have. If the size overcomes one of the bounds, it is offset to the bound. The result of the expression is rounded to two decimals.
Use Residual Capital: when this option is active and the capital is not enough to place the next bet, the bet will be placed anyway, with the size adjusted to use all the residual capital.
Bet Size = Net Win/Liability: when this option is ON, the "Bet Size" amount and the "Size Offset Min/Max" amounts are considered as the target net win (for BACK bets) or the total liability of the bet (for LAY bets). The effective size of the bet is adjusted accordingly.
When the Update option is ON and the bet is unmatched, a new price and a new size are calculated with the same criteria specified for the bet placement, and the bet updated accordingly. The update process is performed until the bet is matched, with an interval in seconds specified in Interval (SQL Expression). This option is usefull, for example, to keep the bet at a certain distance from the front of the market. The use of this option can produce a lot of transactions, expecially if you are placing bets below the minimum size (double the cost in transactions). Ipposnif, in default, will stop placing bets when it has reached the 2000 transactions in the last hour. You can change this limit from the options, but keep in mind that if you overcome the 5000 transactions per hour you will be subject to extra Betfair fees.
Fill Or Kill - Ticks (+integer): cancel the unmatched part of the bet when the distance in ticks between the best back/lay price and the actual bet price is greater than the specified value
Fill Or Kill - Seconds (+integer): cancel the unmatched part of the bet after a specified amount of seconds.
Delete Condition (SQL Assertion): when the SQL Assertion is true, the bet is deleted. When the only bet present in a trade is deleted, also the trade status is automatically set to Deleted.
Close Trade: change the status of the trade accordingly with a specific event. This is useful, for example, to free slots for new bets when the option "Trades per Market" is set to "Multiple trades and runners". Do not close the trade if the strategy may include other bets in it.
Clear Check: remove the runner check applied by the user when a specific event is fired. In some manual strategies, this option is mandatory to prevent new bets after the first one is created.

Expression Watcher

Expression Watcher can help you to debug a strategy.