Author Topic: Average Trade [TCKT25062013AVGT]  (Read 3358 times)

Tags:
  • All members
  • Posts: 141
Average Trade [TCKT25062013AVGT]
« on: 25 Jun 2013, 14:15 »
Hi all,

I'm trying to work out the average trade on the 2nd selection and have written a trigger to get the data. The only problem is The very last variable avg_trade breaks the whole thing and I have no idea why. I have attached the tirgger below.

If you have a look at the variables you can see there is a running total (running_total) and a counter (num) that counts when a trade of over £1 has taken place. So it should be running_total / num is the average - but use either variable and it breaks the whole thing.

Try it for yourself, just remove avg_traded and the rest works fine.

Any help would be greatful.

Thanks,

Whitey :)
Yeah! :p

  • Moderator
  • Posts: 3597
*
Re: Average Trade
« Reply #1 on: 25 Jun 2013, 15:15 »
Hi
Try this. It works OK, but updates the average at the frequency of 2x refresh rate because it is in a repeating block.
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: 141
Re: Average Trade
« Reply #2 on: 25 Jun 2013, 16:09 »
Thanks MarkV (and thanks for the help in the past),

Can you think of a way to make it work faster? At the minute it works better than what I did but it is working out the average by adding 1 to num every 6 seconds or so - but in 6 seconds 20 bets could have been matched at all different amounts.

Or is there a simpler way of doing it?

Thanks,

Whitey
Yeah! :p

  • Moderator
  • Posts: 3597
*
Re: Average Trade
« Reply #3 on: 25 Jun 2013, 18:58 »
Hi
If you view the formula running_total / num in the variables window, it shows the value and updates at a decent rate, using your original trigger.

I was trying to see if there is a way to do the whole thing in one formula, but can't think of it just now. If I do I'll post.

Can anyone else suggest how to improve the speed of the trigger?
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.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: Average Trade
« Reply #4 on: 25 Jun 2013, 20:06 »
hi
the   total_traded   variable, should be the first action, not the second, because  last_bet_amount  variable is using  the total_traded  as part of its calculation.


mcbee
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: 141
Re: Average Trade
« Reply #5 on: 26 Jun 2013, 08:06 »
MarkV:

Oh yeah, weird how you can use running_total / num in the variables window - you can use it like that in the triggers too - so I will just use it like that.

mcbee:

total_traded needs to be below last_bet_amount because last_bet_amount calulates what the total now minus the total before is to get the bet amount. Therefore total_traded will always need to be 1 behind

Thanks,

Whitey
Yeah! :p

 

Please note, BetFair is seems to be currently OFFLINE