I am trying to access last 5 trade bars (aka rolling window or bars). I have created a custom class with a custom array that stores last 5 bars and I run my logic using these 5 bars in the OnData method but its not working. I have couple of questions:

1. Is there an easier method to look at ochlv data of latest 5 bars?

2. Can we create custom classes (in python) and use them in the main algorithm class ?