Author Topic: Problem with timing of calculations  (Read 2853822 times)

Tags:
  • All members
  • Posts: 50
  • Gender: Male
Problem with timing of calculations
« on: 17 Oct 2024, 15:10 »
Hey so I'm doing a recovery staking plan that calculates the next stake on settlement of the previous bet and places the next bet between 0 and 5 mins before the off. If the previous event finishes within 0 and 5 mins before the next event starts, I'm having trouble with the system not calculating the next stake before the next bet is placed so it places the same amount as the previous bet if it lost and then if the next bet wins, it resets to 0 for the loss pot so I'm losing money. 

What's the best way to ensure the calculation has been completed before the next bet is placed, cheers?

  • Moderator
  • Posts: 3675
*
Re: Problem with timing of calculations
« Reply #1 on: 17 Oct 2024, 15:50 »
Hi
Have a look at Item 3 here
It functions as a lock which will let the next bet be placed only if the previous bet has been settled. There is a downloadable template trigger from the link.   

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: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #2 on: 17 Oct 2024, 15:55 »
Hi Mark. I have something similar set up but it's still doing it. I have a variable max_bet which is set at 1 then in the trigger condition for the bet, I have trigger number of runs in the market < max_bet or previous triggered event is settled so the next bet is being triggered when the event is settled but it seems like the calculations aren't being completed before the next bet is placed if the minutes before off is between 0 and 5

  • All members
  • Posts: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #3 on: 17 Oct 2024, 16:07 »
May be easier if you can see the triggers that I've got so I'll list them out :)

  • All members
  • Posts: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #4 on: 17 Oct 2024, 16:17 »
Setting Variables (this sets the variables manually in case there was an error and I had to restart the program)

set user variable
Name: rec_amount (amount of money to recover) Value: rec1 Globally
set user variable
Name: lss_count (number of losses so far) Value: rec2 Globally

One Time Only (No Conditions)

After a win

set user variable
Name: rec_amount Value: 0 Globally
set user variable
Name: lss_count value: 0 Globally
Once per market
Settled
Markets Settled P/L > 0

After a Loss

Set user variable
Name: rec_amount Value: rec_amount - market settled p/l Globally
set user variable
Name: lss_count Value: lss_count + 1 Globally
Once per market
Settled
Markets settled p/l < 0

Place a Lay bet

Lay ... Price: lay_price ... Amount: rec_amount + (lss_count*trg_pft) + trg_pft Take SP
First Matching Selection
Once Per Market
All Except Settled
Markets minutes before the off is between 0 and 5
and selections lay price is equal or less than max_price
AND Trigger Place a Lay Bet number of runs in the market is less than max_bet overall
or previous triggered event status is settled

  • Moderator
  • Posts: 3675
*
Re: Problem with timing of calculations
« Reply #5 on: 17 Oct 2024, 18:12 »
Hi
I think its this condition:
Trigger Place a Lay Bet number of runs in the market is less than max_bet overall

Overall is cumulative number of runs for all markets since start of program.

Firstly try it with overall unticked.

Or try this:
Lay ... Price: lay_price ... Amount: rec_amount + (lss_count*trg_pft) + trg_pft Take SP
First Matching Selection
Once Per Market
All Except Settled
Markets minutes before the off is between 0 and 5
and selections lay price is equal or less than max_price
and Trigger Place a Lay Bet number of runs in the market is less than max_bet
AND
   previous triggered event status is settled
   or Trigger Place a Lay Bet number of runs in the market is equal to 0 overall
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: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #6 on: 17 Oct 2024, 19:02 »
Thanks I'll give it a shot.... I'm also having 2 more problems with getting bets matched and with starting times of some events

  • All members
  • Posts: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #7 on: 17 Oct 2024, 19:06 »
Ideally I don't want to get matched at SP but sometimes the price moves before the bet is matched so if I'm on Betfair then I want to replicate manually moving the price so say I place a bet at 1.50 and the price moves to 1.52 then on Betfair I would move the price to 1.52 and click on the tick. How would I replicate this using a trigger? And with the times, some events seem to start anything between 1 and 12 hours than they are scheduled on the software. This happens especially with Tennis matches. Do you know why this happens? Like I had a tennis event that placed a bet and was scheduled to start but when I check Betfair it said starts in 57 mins

  • All members
  • Posts: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #8 on: 18 Oct 2024, 14:13 »
I've tried unticking overall but isn't working. The system places bets on all events when overall is unticked.

  • All members
  • Posts: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #9 on: 20 Oct 2024, 09:55 »
Would adding a condition to the bet "Previous Triggered Event minutes since last suspension > 1" work? Since the event suspends at the end so after suspension, no bets should be placed for at least one minute which will give the triggers time to make their calculations before a bet is placed on the next event.

  • Moderator
  • Posts: 3675
*
Re: Problem with timing of calculations
« Reply #10 on: 20 Oct 2024, 14:25 »
Hi
Yes a timer would be a good idea though suspension could be open to error if for example a market is suspended for any other reason than the end e.g photo finish, loss of score feed at Betfair etc.

A better timer would be to record current time in after a win and after a loss triggers and use an elapsed timer in the betting trigger.

Try the attached in test mode. Set the time delay in seconds in the constant.  
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.

  • Moderator
  • Posts: 3675
*
Re: Problem with timing of calculations
« Reply #11 on: 20 Oct 2024, 14:35 »
Ideally I don't want to get matched at SP but sometimes the price moves before the bet is matched so if I'm on Betfair then I want to replicate manually moving the price so say I place a bet at 1.50 and the price moves to 1.52 then on Betfair I would move the price to 1.52 and click on the tick. How would I replicate this using a trigger? And with the times, some events seem to start anything between 1 and 12 hours than they are scheduled on the software. This happens especially with Tennis matches. Do you know why this happens? Like I had a tennis event that placed a bet and was scheduled to start but when I check Betfair it said starts in 57 mins
Hi
This trigger will automate following a price up or down.
https://marketfeeder.co.uk/learn/triggers/best-opposite-price/

There is no time limit in a tennis match so scheduled start times are very frequently overrun, sometimes by many hours. There is no way round this really unless you have some external data estimating when the current match on a given court is nearing the end. Betfair only provide the scheduled start time in the API feed.    
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: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #12 on: 20 Oct 2024, 22:37 »
Hey I've set it up using the following condition in the betting trigger so that it should test if the previous event is settled and if it has been 1 minute since the last suspension. This should hopeful counter it placing bets at the wrong time. Do you think it will work?

Trigger placing bets number of runs in the market is less than max_bet
OR
Previous triggered event status is settled
and previous triggered event minutes since last suspension is equal or greater than 1

  • Moderator
  • Posts: 3675
*
Re: Problem with timing of calculations
« Reply #13 on: 22 Oct 2024, 11:11 »
Hey I've set it up using the following condition in the betting trigger so that it should test if the previous event is settled and if it has been 1 minute since the last suspension. This should hopeful counter it placing bets at the wrong time. Do you think it will work? Trigger placing bets number of runs in the market is less than max_bet OR Previous triggered event status is settled and previous triggered event minutes since last suspension is equal or greater than 1
Hi
I tested those conditions in Time Machine and they work fine
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: 50
  • Gender: Male
Re: Problem with timing of calculations
« Reply #14 on: 23 Oct 2024, 01:26 »
I think you were right the first. Had a bet placed before calculations were done so I've set it up using the time delay as you suggested. Working like a dream now 😀

 

Please note, BetFair is seems to be currently OFFLINE