Author Topic: Understanding time  (Read 585 times)

Tags:
  • All members
  • Posts: 59
Understanding time
« on: 29 Dec 2022, 15:03 »
I'm having some trouble utilising the time variables.

I have triggers that open and close trades.  Sometimes they close with the incorrect stake, which means they leave the trade with a larger PL on one side.

To get around this, I have created a trigger that waits a few minutes after the last matched bet, and then equalises the PL.  Which works quite well in Time Machine.



The trigger above waits until 
-There are no unmatched bets.
-There is at least 1 matched bet
-(now_time-bm_1_laytime) or (now_time-bm_1_backtime) is greater than 0.004

I came up with 0.004 by dumping out the times, and working out what they meant.

10:20:00 = 43487.4305563
10:25:33 = 43487.4344155 

By the above, I concluded that 0.004 is about 5 mins.

Unfortunately, it doesn't work as expected.

As you can see below, the trade is executing instantaneously:


Would anyone be able to shed some light onto this, as I can't quite work out what I've done wrong?



  • Moderator
  • Posts: 3606
*
Re: Understanding time
« Reply #1 on: 29 Dec 2022, 18:08 »
Hi
Try:
(now_time-bm_1_laytime)/mf_minute is greater than 5

the helpfile has a section on the date and time format and time calculations but it is easier to use the variables that define a second, or a minute or an hour.

e.g. the above formula could also be:
(now_time-bm_1_laytime)/mf_second is greater than 300 
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.

  • Tim Vetrov
  • Administrator
  • Posts: 4874
  • Gender: Male
*
Re: Understanding time
« Reply #2 on: 29 Dec 2022, 18:18 »
There is a principal difference in these variables:
bu_1_backtime / bu_1_laytime - the time the bet was placed
bm_1_backtime / bm_1_laytime - the time the bet was matched


So it's always
bm_1_backtime >= bu_1_backtime
for the same bet.
And... it's possible the last matched bet is not the same as the last unmatched bet was!
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 59
Re: Understanding time
« Reply #3 on: 29 Dec 2022, 18:37 »
Thanks guys

 

Please note, BetFair is seems to be currently OFFLINE