Author Topic: Problem with trigger  (Read 3392 times)

Tags:
  • All members
  • Posts: 63
Problem with trigger
« on: 21 Dec 2019, 10:36 »
Hi,

I'm currently having an intermittent problem with one of my programs which I can't explain.

A section of the trigger checks to see if there are any unmatched back bets at the current lay_price (along with other conditions) and if there isn't any unmatched back bets at the lay_price, then it places one.

The majority of the time this works fine, but i've noticed a few times now it seems to stop working and it continues to place several back bets at the lay_price, even though there are already unmatched back bets there.

This is a section of the trigger logs:

18:48:24 Checking condition and Selection's Trigger Expression bu_bpricedat_layprice is equal to 0.
18:48:24 Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:24 Going to BACK on 1 selections:

Fiorentina, £ 5.00 at 3.40;Unmatched bets will be cancelled at In-Play.


18:48:25 Checking condition and Selection's Trigger Expression bu_bpricedat_layprice is equal to 0.
18:48:25 Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:25 Going to BACK on 1 selections:

Fiorentina, £ 5.00 at 3.40;Unmatched bets will be cancelled at In-Play.



18:48:27 Checking condition and Selection's Trigger Expression bu_bpricedat_layprice is equal to 0.
18:48:27 Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:27 Going to BACK on 1 selections:

Fiorentina, £ 5.00 at 3.40;Unmatched bets will be cancelled at In-Play.



18:48:29 Checking condition and Selection's Trigger Expression bu_bpricedat_layprice is equal to 0.
18:48:29 Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:29 Going to BACK on 1 selections:

Fiorentina, £ 5.00 at 3.40;Unmatched bets will be cancelled at In-Play.


And this is a section of the program logs showing the bets being placed and then all of them being cancelled by another trigger:

18:48:24
Fiorentina v Roma: Going to BACK £ 5.00 at 3.40 on selection 'Fiorentina'. Bet is unmatched. If unmatched, bet will be cancelled at In-Play. The bet was placed/cancelled by Trigger "Place Outside Back Bet".

18:48:25
Fiorentina v Roma: Going to BACK £ 5.00 at 3.40 on selection 'Fiorentina'. Bet is unmatched. If unmatched, bet will be cancelled at In-Play. The bet was placed/cancelled by Trigger "Place Outside Back Bet".

18:48:27
Fiorentina v Roma: Going to BACK £ 5.00 at 3.40 on selection 'Fiorentina'. Bet is unmatched. If unmatched, bet will be cancelled at In-Play. The bet was placed/cancelled by Trigger "Place Outside Back Bet".

18:48:29
Fiorentina v Roma: Going to BACK £ 5.00 at 3.40 on selection 'Fiorentina'. Bet is unmatched. If unmatched, bet will be cancelled at In-Play. The bet was placed/cancelled by Trigger "Place Outside Back Bet".

18:48:51
Cancelling the following bets in market "Soccer / Italian Football / Italian Serie A / Fixtures 20 Dec / Fiorentina v Roma / Match Odds":
BACK £ 5.00 at 3.40 on "Fiorentina"
BACK £ 5.00 at 3.40 on "Fiorentina"
BACK £ 5.00 at 3.40 on "Fiorentina"
BACK £ 5.00 at 3.40 on "Fiorentina"
The bet was placed/cancelled by Bets were cancelled by: Cancel Back Bet.


Any help appreciated.

Thanks.

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #1 on: 21 Dec 2019, 10:48 »
I forgot to mention, but 'layprice' is just a user variable I define for 'lay_price' in another trigger.

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #2 on: 21 Dec 2019, 11:33 »
A section of the logs from the trigger setting the user variable:

Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:23 Setting variable layprice to 3.40.

Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:25 Setting variable layprice to 3.40.

Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:27 Setting variable layprice to 3.40.

Condition is: TRUE. valid for 1 selections: Fiorentina.
18:48:29 Setting variable layprice to 3.40.

  • Moderator
  • Posts: 3654
*
Re: Problem with trigger
« Reply #3 on: 21 Dec 2019, 16:24 »
Hi
a few things could be worth checking:

the market refresh rate looks to be around 1s or 2s, but what is the rate of updating the list of bets in the settings.

are any of these triggers executing no more often than x? x should be greater than frequency of updating list of bets

are the values of layprice and lay_price exactly the same at the moment of checking the condition? i.e. could there be a price change after layprice variable was set? you could put in a condition to make sure they are equal if that's what they need to be.
  
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.

  • Administrator
  • Posts: 8819
  • Gender: Female
*
Re: Problem with trigger
« Reply #4 on: 21 Dec 2019, 21:34 »
What MarkV said about the market refresh being faster than the rate of updating the bets is very valid.

It takes time for your bet to appear in the list, therefore, for a few seconds after you place a bet, the program will not see it, therefore firing the next bet oblivious to the previous one.

The trick that always works for me is to set some variable with a timestamp in the same trigger that makes a bet (by adding a "set user variable" action), e.g.:

set user variable last_bet_time to now_time

Then in any trigger that needs to cancel or place the bet, check the following condition:

Selection's Trigger Expression (now_time - last_bet_time)/mf_second is greater than 3

as 3 sec seem enough for the bets to be registered.

Obviously, you need to initialise this variable with 0 using a separate trigger at the beginning of your trigger block.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #5 on: 22 Dec 2019, 02:39 »
Many thanks for both taking the time to look into this, much appreciated. 

My refresh rate is currently set to 1 second, and my triggers are firing 'no more often than 1 second'. I'm not sure if that is the most efficient way of doing it but I essentially want them to fire on every refresh, so every second.

Previously I wondered if there was sometimes a difference between layprice and lay_price, so I have already added a conditon to make sure they are equal.

I'm unsure what this list update rate in the settings is though, so maybe that is my problem. I'll go through the settings on the program tomorrow to try and find this and I'll let you know.

Many thanks. 

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #6 on: 22 Dec 2019, 11:06 »
Right OK, so I've now found this 'update bet list rate' setting and it's currently set to 3 seconds which I'm assuming is default.

So yes it does appear that this is going to be my issue.

From what you've said, it doesn't sound like a simple case of changing this update list setting to 1 second?

Is it recommended to leave this at 3 seconds and change the triggers so that they're not firing at a faster rate than this?

Many thanks. 

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #7 on: 23 Dec 2019, 14:30 »
Is this section from the manual referring to the same thing?

Ideally I would like it to be less than 3 seconds as it seems quite a long time to wait if scalping.

Many thanks.

  • All members
  • Posts: 63
Re: Problem with trigger
« Reply #8 on: 23 Dec 2019, 17:58 »
Sorry for bombarding this thread with my replies...

So from looking in the settings again, the list of bets is set to update every 3 seconds, however the tick box 'update bets individually for each market' is selected, so doesn't this mean that this should update in line with the market refresh rate, in my case every second?

Thanks again.

  • Moderator
  • Posts: 3654
*
Re: Problem with trigger
« Reply #9 on: 23 Dec 2019, 20:22 »
Hi
Yes if ticked it will update the bets information with market refresh, however, there will always be some latency in communication with Betfair and it will be variable, so it is possible a bet submission would not be returned back to MFP from Betfair on the next refresh.

I use a similar condition to Oxa's to make sure two refreshes have passed since the last bet before triggering any other betting transaction:
selections trigger expression (now_time-lbtime)/mf_second is greater than idle_rate*2
lbtime is same as Oxa's last_bet_time

By the way I just tested bets refresh at 0.5sec on one market and it works ok, not sure what performance will be with multiple markets.
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: 63
Re: Problem with trigger
« Reply #10 on: 24 Dec 2019, 13:38 »
Right OK, so it seems my settings are OK and the issue here is likely connectivity issues to Betfair, most probably my ISP. 

That would at least explain why this is intermittent for me and most of the time it's worked perfectly. 

I think I'll personally try and avoid a fixed delay in my case as I'd like it to trigger on every refresh if possible.

Maybe I'll look into the possibility of also setting a user variable, 'last_bet_registered' to 'no' on the back trigger, then having another trigger which sets the same variable to 'yes' once it's listed. Another condition on the back trigger would be to make sure this variable is set to 'yes' first. 

Many thanks again for looking into this and helping me out, much appreciated. 

 

Please note, BetFair is seems to be currently OFFLINE