Indexing a list in the same manner as backtrader
I have a list of values. In order to be consistent with the platform, I would like to access the most recent value a 0, second most recent as -1 and so on as describes in the concepts section below.
How can I implement something similar on my list? I can append to the front of the list to access 0 as the most recent but I am not sure how to get -1 not to point to the end of the list.
len(array) - 1 + your_index
len(array) - 1(which is the last element)
len(arry) - 1 - 1(which is the element before the last element)
And so on