How to get each line name in the indicator
Say that an indicator sample as below:
class MyIndicator(bt.indicator): lines = ('mva1', 'mva2') def __init__(self): self.l.mav1 = .... self.l.mav2 = ....
My question here is how to get the names, 'mva1' 'mva2', from the existed MyIndicator? I would like to iterate myindicator.lines to get the names but it seems no such attribute, any idea?
SVetter last edited by
Not sure why you would need that? Can you maybe give some more context? Given that you have created the lines mav1-mav2 (and given they are not generated dnyamically), why do you need to iterate instead of addressing them individually?
All lines in the indicator are for computing the signals, I need to dump them out for checking if there is any computing error. My idea is to dump them to a DataFrame with date as index and each line as column.
vladisld last edited by
Try to use the indicator's
_getlines()method. This should return the tuple of all the line names.
Thanks. I can get the name list and then using _getline('name') to fetch the line object.
By the way, I find it's not easy to get the datetime series from the indicator instance, how can I do?