Author Topic: Calling triggers as subroutines  (Read 314 times)

  • All members
  • Posts: 13
  • Gender: Male
Calling triggers as subroutines
« on: 05 Nov 2022, 22:33 »

I would like to have the same logic happen under several circumstances. Can I contain that logic in a trigger and then "call" it when the circumstances happen? 

For example, in the Correct Score market, if the score is 2-1 or 1-2 and the match minute is less than 60, I want to: calculate a stake, place a lay bet on the current score, write to the log and send an email. Or if the score is 3-0 or 0-3 any time, I want to write to the log and green up for a profit or distribute the loss.

I would like to contain the three or four sets of logic in one place, test for score and match minute, and call the right logic. 

How would I do this?

Thank you,

  • Moderator
  • Posts: 3564
Re: Calling triggers as subroutines
« Reply #1 on: 06 Nov 2022, 13:31 »
What you describe in your examples can be done perfectly in triggers.
Please see attached trigger file which contains 2 triggers.

The first trigger will:
lay current score
send email
write to log
current score is 2-1 or 1-2
match minute is less than 60

Second trigger will:
trade out any selection with an opening trade to even profit or even loss
write to log
current score is 3-0 or 0-3

Naturally this is an example based your description so you can see how it is done. Please use test mode.  
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