Hi,
I have an algorithm which deals with Open, Low, Close and High data. The algorithm looks for some specific patterns. These patterns are not over a fixed number of bars as such, so there are a lot of loops in my algo to go over the price history multiple times trying to figure out the price relationships.
In calculating my final outputs, which is a trend value, along with specific importantprice levels, the algo creates many other temporary variables (around 20 or so). I have coded algorithms extensively in Amibroker and some in Java, the structuring of the code is very different for Amibroker code, as it works on each symbol's price history as an array of price values (OHLC), and I can create/update variables on every bar as I see fit.
My question is what is the best way to structure this kind of code for the Quantopian platform, which does a lot of to and fro traversing over price history while referencing multiple variables at different positions in the Array. There is around 1000 lines of such code.
My understanding is that all the data crunching happens in handle_data() function but if I try to do this kind of stuff in handle_data(), I end up with timeouts. Are there any best practices around structuring the code dealing with this kind of logic? Any inputs appreciated.
Thanks.