Author Topic: Does the order of Conditions matter?  (Read 1279 times)

Tags:
  • All members
  • Posts: 44
Does the order of Conditions matter?
« on: 24 May 2018, 07:30 »
If I have a trigger with several conditions that are to be met before a bet is made or a lay offered does their order make any difference to MFPro or is this taken care of internally in the program?

Say for example a condition is that Minimum Traded Volume be 50000 and a back bet is made Less Than or Equal to the Off and the horse is present in a selection file and meets a particular price.

Is a particular order better than any others ie faster or uses less computer resources?

Thanks for any advice!

  • All members
  • Posts: 24
  • Gender: Male
Re: Does the order of Conditions matter?
« Reply #1 on: 24 May 2018, 08:28 »
when I do it, I put the markets minutes before the off is less than 30 seconds for example, the log file is quite clean as thats all its doing at that time, then check if horses name is in file, so when the other conditions are checked, they are checked just for them horses.

Not sure if it uses any less resources or not, but the log is cleaner

  • All members
  • Posts: 44
Re: Does the order of Conditions matter?
« Reply #2 on: 24 May 2018, 08:57 »
Thanks baron!
Excellent idea, the log files can get cluttered unnecessarily, I will implement your suggestion.

  • Administrator
  • Posts: 8812
  • Gender: Female
*
Re: Does the order of Conditions matter?
« Reply #3 on: 24 May 2018, 13:23 »
Hello!

Yes, of course the order of the conditions matters.

Conditions often act as filters, so the more selections you filter out at the beginning, the easier and faster the next ones will be processed.

Example:

- Selection's Trigger Expression IF(back_amount>=min_amt, r_ticks(back_price, 1), IF(back_amount2>=min_amt, r_ticks(back_price2, 1), r_ticks(back_price3, 1))) is greater than 3.0
- and Market's Status is Idle
- and Selection's Rank is between 2 and 3


The above order is very inefficient. The parsing of trigger expression is a very resource-consuming operation. It is much more reasonable to first check if the status of the market is right. If it is not the case, then no need to check the trigger expression at all. The next one should be the selection's rank, as it is a comparatively simple operation: just to check one integer (selection's rank). So the right order should be:

- Market's Status is Idle
- and Selection's Rank is between 2 and 3
- and Selection's Trigger Expression IF(back_amount>=min_amt, r_ticks(back_price, 1), IF(back_amount2>=min_amt, r_ticks(back_price2, 1), r_ticks(back_price3, 1))) is greater than 3.0


There are also cases when the order of the conditions may change the actual qualifying selections. 

Example 1:


Selection's Rank is less than 6
Selection's Back Price is greater than 7.0
and Selection's Trigger Expression matching_number is less than 3


Example 2:


Selection's Rank is less than 6
and Selection's Trigger Expression matching_number is less than 3
Selection's Back Price is greater than 7.0


What do we have here?
In Example 1, the conditions will be met if out of the first 5 favourites, there are less than 3 selections priced above 7.0.

In Example 2 though, the conditions will only be true if there are just 2 selections in the market and both are priced above 7.0 (I think such markets just do not exist), because it effectively says "our of the first 5 favourites, there must be less than 3 of them".

Hope you see what I mean.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

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

  • All members
  • Posts: 44
Re: Does the order of Conditions matter?
« Reply #4 on: 24 May 2018, 17:26 »
Thanks Oxa!

Your post has cleared this up nicely: I had thought the internal programming may have sorted out the best order or optimized the triggers in some way.

Everything is now much clearer: back to some more trigger wrangling!

 

Please note, BetFair is seems to be currently OFFLINE