Hi all, I'm trying to build a simple in-play scalping strategy in automation, and I’m stuck trying to replicate the following logic using BA.
I want to check if a horse's Last Traded Price has increased by say 15% or more compared to what it was 3 seconds ago.
Example: if it was 6.0 and now it’s 6.9+, that’s a spike I want to detect.
Then, once that spike has occurred, I want to check if the price has started to fall — i.e., the current LTP is lower than it was 1 second ago.
I've tried using Relative Odds and Historical Odds conditions, but I can’t seem to compare the current price to the price from 3 seconds ago (or find the minimum in the last few seconds).
Is the best approach to store the LTP every few seconds using a stored value, then compare it using a Stored Value Condition? If so, what’s the best way to do that accurately for fast in-play changes?
Would really appreciate if anyone can help me figure out the best way to build these conditions. Thanks!
Help with Stored Values
- jamesedwards
- Posts: 4239
- Joined: Wed Nov 21, 2018 6:16 pm
You do not have the required permissions to view the files attached to this post.
- jamesedwards
- Posts: 4239
- Joined: Wed Nov 21, 2018 6:16 pm
I asked ChatGPT, it's done a reasonable job. Basically, use history lists.
Compare a horse’s current TPD speed with the value 10 s ago (Automation how-to)
Goal: trigger a rule when a runner is travelling more slowly than it was 10 seconds ago, without using Excel.
1 ) Capture the live speed on every refresh
2 ) Test the current speed against the value 10 seconds ago
3 ) Optional – require a minimum % drop
In the same condition you can use the Adjustment box to tighten the test, e.g.:
…would only trigger after at least a 2 % slowdown.
4 ) Guard against stale data
Add a Total Performance Data condition such as:
…to make sure you’re never comparing out-of-date numbers.
5 ) (Nice-to-have) display the historic figures
Recap
Compare a horse’s current TPD speed with the value 10 s ago (Automation how-to)
Goal: trigger a rule when a runner is travelling more slowly than it was 10 seconds ago, without using Excel.
1 ) Capture the live speed on every refresh
- Add a Set/Modify a Stored Value rule.
- Action: Store a value in a History List.
- History List: pick an unused list (e.g. History List 1).
- Value to store: TPD – Speed (m/s).
- Timing: trigger Every refresh (or every 0.2 s if you run the main screen that fast).
2 ) Test the current speed against the value 10 seconds ago
- Create a second rule (e.g. “Check speed drop”) and give it whatever action you want when the horse is slowing (alert, hedge, lay, etc.).
- On the Conditions tab add a Stored Value condition:
Code: Select all
Value A: TPD – Speed (current) Compare : Less Than Value B: History List 1 – 10 seconds ago
3 ) Optional – require a minimum % drop
In the same condition you can use the Adjustment box to tighten the test, e.g.:
Code: Select all
Value B × 0.98
4 ) Guard against stale data
Add a Total Performance Data condition such as:
Code: Select all
TPD update occurred < 0.25 s ago
5 ) (Nice-to-have) display the historic figures
- Create a custom column (or Ladder Additional Info cell) that shows
“History List 1 – 10 seconds ago” so you can see the reference value live. - Or tick Excel > Export Historic Values if you want to chart the speeds externally.
Recap
- Store live speed into a History List every refresh.
- Use a Stored Value condition to compare the current entry with the one from 10 s ago.
- Trigger your alert/bet when the horse is travelling more slowly than before.
Thanks
You do not have the required permissions to view the files attached to this post.
- jamesedwards
- Posts: 4239
- Joined: Wed Nov 21, 2018 6:16 pm
I suggest you focus on one thing at a time, and park the TPD stuff for now until you have the basic lay up and running.
For the first part:
> You were storing unlimited number of 'initial_odds' SVs every 5 seconds. I assume you wanted to just do this once?
> Perhaps you would be better off using the SP rather than storing a separate SV?
> You're trying to trigger a bet on the favourite at that moment in time. The favourite will change throughout the race based on the latest price. Perhaps use a custom ranking based on SP to identify the fav?
> I've never used the' weight of money' condition, but that might be a little high at >60%?
You do not have the required permissions to view the files attached to this post.
- jamesedwards
- Posts: 4239
- Joined: Wed Nov 21, 2018 6:16 pm
I'm not sure what it is that you are trying to do.
If you want a static fav based on SP then set a rank based on SP and do it that way. If you want to use whatever is fav at that moment then it's easier, just use the 'historic relative odds' condition that I screenshotted earlier.