Addressing History Values by datapoint as well as time

Help improve Bet Angel.
Post Reply
Bet Angel
Bet Angel
Bet Angel
Posts: 3999
Joined: Tue Apr 14, 2009 3:47 pm

sniffer66 wrote:
Tue Mar 09, 2021 1:28 pm
How about referencing them by count, as per my original suggestion then ? My assumption is that wouldn't require a key

As an example, say I save a History value for 1st Serve% In at the end of each selections service game. I want to compare the value 6 service games ago with the current value so I reference the value 6 entries ago in History List x in my SV condition. I can't do that with the current time based compare.
Unfortunately there isn't the concept of 'when you set the value into the history list' only what the value is at any given time.

e.g. Imagine we are capturing from 2pm.
At 14:00:01 you set a history list with the value of 1 and 100ms later at 14:00:01.100 give it the value of 2.
At 14:00:02.800 you give it a value of 3
At 14:00:04.200 you give it a value of 4.

From the history lists point of view (stored as half-second OHLC data against the chart price data) the values from 2pm are:

14:00:00.0 : null
14:00:00.500: null
14:00:01.0: High 2, Low 1, Close 2
14:00:01.500: Close 2 (no need to store OHL as value didn't change)
14:00:02.0: Close 2
14:00:02.500: Open 2, High 3, Low 2, Close 3
14:00:03.0: Close 3
14:00:03.500: Close 3
14:00:04.0: Open 3, High 4, Low 3, Close 4
14:00:04.500: Close 4
14:00:05.0: Close 4
14:00:05.500: Close 4

So you've given it 4 values, but two are in the same data point and there are ten datapoints between 14:00:01 and 14:00:05.500.
To do what you ask, you'd have to hunt back from the most recent datapoint and derive a new list of values regardless of time. You'd probably have to just use the 'close' values as the specific order of multiple values set in the same half second timeframe would be lost.

Not impossible, but not as performant as a direct lookup x half-seconds ago, and generally would have to be treated as a special case for History List interaction. i.e. You'd probably have to do it by Setting another Stored Value with the value of a history list 'x' changes ago, rather than just having it inline in an Automation condition or on display on the ladder/One-click.

Just thought, there's also the issue of if you Set the history list with the Same value. It's not going to know when that happened as nothing changed.

Hope that makes sense.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

Thanks for the detailed reply BA

As a non dev I was assuming a History List was held as an array/table, with the value in the row and the time in the column (or vice versa). So, to address by count it was as simple as specifying a column number to return a previous value.

I get the argument re the issue when writng constantly to the list, but I only want to write a value every 2 mins or so, then retrieve them and run a calc on the sum etc.

Will have to see if I can come up with a workaround using multiple SV's and address them individually - but that has it's own challenges :)
It's a shame as a History List would have been the most elegant solution.
User avatar
jimibt
Posts: 3641
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

sniffer66 wrote:
Wed Mar 10, 2021 8:36 am
Thanks for the detailed reply BA

As a non dev I was assuming a History List was held as an array/table, with the value in the row and the time in the column (or vice versa). So, to address by count it was as simple as specifying a column number to return a previous value.

I get the argument re the issue when writng constantly to the list, but I only want to write a value every 2 mins or so, then retrieve them and run a calc on the sum etc.

Will have to see if I can come up with a workaround using multiple SV's and address them individually - but that has it's own challenges :)
It's a shame as a History List would have been the most elegant solution.
Thinking around this. How about a NEW function (yes, yet another new function), called Snapshots that allow you to save history lists in the state that they are at that point with a key or index value by which to access them??

if memory was an issue, it could be created as a FIFO list that contained a maximum of 40-50 entries. (or could have an expiry time limit set against the item that was input, thus it would drop off after xxx seconds/minutes)
Bet Angel
Bet Angel
Bet Angel
Posts: 3999
Joined: Tue Apr 14, 2009 3:47 pm

jimibt wrote:
Wed Mar 10, 2021 8:56 am
Thinking around this. How about a NEW function (yes, yet another new function), called Snapshots that allow you to save history lists in the state that they are at that point with a key or index value by which to access them??

if memory was an issue, it could be created as a FIFO list that contained a maximum of 40-50 entries. (or could have an expiry time limit set against the item that was input, thus it would drop off after xxx seconds/minutes)
Yes, I see what you mean and it would be something different to the way History Lists and Stored Values are handled.
We'll have to have a think about it, crunch the numbers with regard to memory usage, and generally see how it would fit in to the rest of the application.
FIFO makes sense from a memory management point of view, and that would suggest that the '0' index in the data structure is the most recent rather than the first stored, but I can foresee requests for accessing the data indirectly with the index being held in another stored value. Following that you'd probably have a need to know the 'length' of the data currently stored so that the index can be computed. It soon starts getting more complex from the user interface point of view to work with the data structure.

Perhaps if the rest of this thread could be +1s from the community along with how you would wish to interact/use an index based (rather than time based) storage mechanism, then we can judge the level of demand and consensus.
User avatar
jimibt
Posts: 3641
Joined: Mon Nov 30, 2015 6:42 pm
Location: Narnia

Bet Angel wrote:
Wed Mar 10, 2021 11:25 am
jimibt wrote:
Wed Mar 10, 2021 8:56 am
Thinking around this. How about a NEW function (yes, yet another new function), called Snapshots that allow you to save history lists in the state that they are at that point with a key or index value by which to access them??

if memory was an issue, it could be created as a FIFO list that contained a maximum of 40-50 entries. (or could have an expiry time limit set against the item that was input, thus it would drop off after xxx seconds/minutes)
Yes, I see what you mean and it would be something different to the way History Lists and Stored Values are handled.
We'll have to have a think about it, crunch the numbers with regard to memory usage, and generally see how it would fit in to the rest of the application.
FIFO makes sense from a memory management point of view, and that would suggest that the '0' index in the data structure is the most recent rather than the first stored, but I can foresee requests for accessing the data indirectly with the index being held in another stored value. Following that you'd probably have a need to know the 'length' of the data currently stored so that the index can be computed. It soon starts getting more complex from the user interface point of view to work with the data structure.

Perhaps if the rest of this thread could be +1s from the community along with how you would wish to interact/use an index based (rather than time based) storage mechanism, then we can judge the level of demand and consensus.
ok, i'll set the ball rolling

+1 for implementing something alsong these lines.
sniffer66
Posts: 1666
Joined: Thu May 02, 2019 8:37 am

I guess my +1 doesnt count but I'll chuck it in anyway :)

Will benefit anyone who wants to do a lookup on any milestone based event in a market. As well as tennis I'm thinking, since a goal in football...
User avatar
Silverthorn
Posts: 26
Joined: Sat Mar 13, 2021 2:47 pm
Location: Australia

sniffer66 wrote:
Mon Mar 08, 2021 1:59 pm
I'd like to put forward a suggestion to be able to refer to values in a History List by the number of data points ago, as well as being able to select time in secs/mins
I was just trying to figure out how to reference previous ticks to more accurately identify price movement and found this thread when searching.

What I'm wondering is if it is possible to reference the bars on the chart of the ladder screen. ie. price 2 bars ago was higher than price 1 bar ago. I believe this is similar if not the same sort of thing. Referencing based on event rather than time.

Is the data that produces the in ladder chart accessible for use in rules or could it be possible?
Post Reply

Return to “Suggestions”