I am trying to implement a Pairs trading strategy wherein i calculate the ratio of stock prices, find their zscore and use that zscore to create an upper and lower bound for it. I wanted to know if there was a way to calculate the average of all zscores in the init function. I tried using the Average class of Indicators, but it calculates the average at every bar, whereas i want a way to have precalculated average. Is there any way to do it using backtrader rather than doing it manually? Thanks for the help!
For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Latest posts made by Vivan Maitreya
-
Calculating average beforehand