Feeding Multiple Data Feeds in Indicators
Hi! I would like to ask how to add multiple data feeds into indicators. I am using StandardDeviation indicator and instead of using multiple indicators, I am planning to input 3 data into the indicator so that the indicator can give me 3 sd for different data. Thanks :)
You can pass as many data feeds (or anything that looks like it, like indicators for example) to indicators. The same concepts applied to reach data feeds are applied in indicators.
Can you give an example about indicator instance initiation? The example you referred, I think, is a build-in class. Can you elaborate on how to self define an indicator class with multiple data as input? Thanks!
It's already built-in. From the documentation link:
Data Feeds are automagically provided member variables to the strategy in the form of an array and shortcuts to the array positions
And the same applies to indicators, with the exception noted in: Docs - Using Indicators in the section Some Notes
This is intentional. If no data is passed, the 1st data of the parent (in this case the Strategy in which is being created) will be automatically passed in the background
I.e.: You don't need to define anything. The data(s) are provided automatically to the indicator in the
And the minimum number that a caller has to provide can be determined. See Blog - Crossing over numbers
@backtrader Thanks! I later solved it by passing self.data into the instance initiation and it works. I wonder if there is a way to control the size of indicator panel? The height is too narrow to see the exact value for me. Thanks!