Author Topic: [TR] stopping at winner  (Read 1831 times)

Tags:
  • All members
  • Posts: 314
[TR] stopping at winner
« on: 15 May 2016, 16:00 »
this is related to my other question https://community.welldonesoft.com/marketfeeder-troubleshooting/check-for-market-name-in-file/msg52047/#msg52047

The idea is that I place a lay bet on the favourite, using certain conditions, and if it wins, that's the end. If the horse wins, then I need to use loss recovery on the next qualifying race to get back my loss (100%) and also place the stake value.

I currently have a simple constant called _add which contains the amount lost, and this is used in the back amount formula

as (bank_size * perc_bet) + (_add/0.95)

Ideally, I would really like to be able to detect if the horse won or lost, and then have something in the trigger(s) to either stop at the winning bet, or increase the next bet amount according to the formula above. It has a maximum of 3 losing bets and if that's reached, I write off my losses.

I suspect this would be easy to do if I didn't have other strategies running, but I do have a number of them running, and so detecting the win amount or loss amount may not be related to that specific race of that strategy, so I am a bit stuck on how to do this.

in a nutshell, here is what I am trying to achieve

1. Lay the favourite, using the market_id condition, and odds > _some_odds, lay amount = (bank_size * perc_bet) + (_add/0.95)
2. if horse loses, stop
3. If horse wins, then add losses to the _add variable (constant)
4. Lay the favourite, using the market_id condition, and odds > _some_odds, lay amount = (bank_size * perc_bet) + (_add/0.95)
5. if horse loses, stop
6. If horse wins, then add losses to the existing _add variable (constant)
7. no matter what, this is the 3rd race, so no more betting after this (there will only be 3 market_id's anyway), if it wins, then write off losses

I want the trigger to use the following conditions...

check for minutes before off to be between low_toff and high_toff
market_id in file (.....)
Rank = 1
odds greater than or equal to _low


the conditions can only be based on the specific horse that is bet on, and detecting whether it has won or lost, and then taking the action, as above. I may have other strategies that are using this horse for betting, and it may even be that it places a back bet - so, in effect, for this strategy, I am looking to see if this horse won or lost its race, then take appropriate action.

I want the _add value updated on a losing race, and I want the following formula used to place the next bet...

(bank_size * perc_bet) + (_add/0.95)

which is effectively the normal stake amount to win plus the loss, accounting for commission.

I would like the constants to be as follows

   <constants>
      <const name="bank_size" value="100.00" descr="bank Size" saveValue="0"/>
      <const name="perc_bet" value="0.0125" descr="percentage bet" saveValue="0"/>
      <const name="low_toff" value="4.7" descr="4.7minutes before the off" saveValue="0"/>
      <const name="high_toff" value="5" descr="5 minutes before the off" saveValue="0"/>
      <const name="_add" value="0" descr="Loss amount" saveValue="0"/>
      <const name="_low" value="3.5" descr="Odds value" saveValue="0"/>
   </constants>

perhaps _add may not be needed as it may require initial setup via some other way that does not require a constants value?

and I would prefer to keep the names I have used.

I am attaching my trigger, which does the simple job of placing the lay bet based on the above, but without the loss recovery. If you can adjust this, then fine.

FYI, I put this together from a strategy I learned about which uses the 3rd, 5th and 8th races of the day (including Irish), and has had some good success, and that's why you will see _358 in the constants....

Thanks

Mark.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: stopping at winner
« Reply #1 on: 15 May 2016, 23:56 »
hi
here is your trigger, there are no new constants to set.
the trigger will bet until a winner or there are 3 losses it will keep the bank balance for the next days betting.
please note that the trigger calculations are different that betfair calculations so the trigger bank balance may be a few pence different + or - .
i also had to alter your expected percent profit from 0.025 to 0.0025 due to the third bet not having enough funds to cover the lay liability.

please use test mode until you are happy with your settings

mcbee

download the trigger below
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: stopping at winner
« Reply #2 on: 16 May 2016, 08:01 »
Hi,

Thanks for the trigger.

I cannot see the part which originally gave the condition "Selection's Trigger Expression market_id is in file ......"

and because this is now multiple triggers, I am not sure where I put this condition

Can you adjust it please?

Thanks

Mark.

  • All members
  • Posts: 314
Re: stopping at winner
« Reply #3 on: 16 May 2016, 08:08 »
There also seems to be another thing in there which may or may not be correct...

AT THE TIME of the check, which is between low_toff_358 and high_toff_358, the trigger checks for the favourite at that time, and if the condition is met, i.e. its the favourite AND it has odds >= 3.5, then it places the bet. BUT, I have seen a few times where these conditions were met, and then another horse places as favourite

I can see in your check win/lose trigger, that you have Selections as Favourite - is this correct?

Mark

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: stopping at winner
« Reply #4 on: 16 May 2016, 10:30 »
hi
sorry i had to test the trigger using my list and removed then forgot to add your condition for your file location.
Quote
I can see in your check win/lose trigger, that you have Selections as Favorite - is this correct?
the favorite is only used to activate the trigger it has nothing to do with any conditions.

mcbee

please download the trigger below
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 314
Re: stopping at winner
« Reply #5 on: 16 May 2016, 14:12 »
hi,

Not sure if it has been a success today, because I don't know how to monitor if the conditions are being checked via the trigger. It placed the first bet (race 3) which was a losing horse, so it won, and then, I can see that the BSP of the other 2 races were below the required 3.5 - which makes me assume it was below that at the time to do the checks. I don't know if the trigger has stopped betting, due to the win or it is carrying on. I can also see that the bank value has not been updated

This is not a complaint, I am very happy with what you have done, I just don't know how to debug and check it is doing as I hoped? Can you provide any advice on how to do a debug check? - sorry if you do not use the terminology I use, but if not, when I say debug, it means run through the code in real time, and check the variables' value etc..

First question is, should the bank have increased its value?
second is, is there no indicator present to let me know that it has finished its cycle?

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: stopping at winner
« Reply #6 on: 16 May 2016, 14:55 »
hi
if it was a lay win then there would be no more bets placed.
the bank amount in the constants will only alter when mfp is shut down.

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: stopping at winner
« Reply #7 on: 16 May 2016, 15:00 »
hi
open the variable window
type  wl
when the value is 0 then bets are made, if the value is 1 then there is a lay win or 3 losses in a row.
next line  type   bank_size_358
this will show the current trigger bank amount

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

 

Please note, BetFair is seems to be currently OFFLINE