Skip to content

Commit

Permalink
Support plotname, if given, as name of indicator in csv output
Browse files Browse the repository at this point in the history
  • Loading branch information
backtrader committed May 3, 2018
1 parent 9bfaaff commit b239e7e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions backtrader/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ def getwriterheaders(self):

# prepare the indicators/observers data headers
for iocsv in self.indobscsv:
headers.append(iocsv.__class__.__name__)
name = iocsv.plotinfo.plotname or iocsv.__class__.__name__
headers.append(name)
headers.append('len')
headers.extend(iocsv.getlinealiases())

Expand All @@ -415,7 +416,8 @@ def getwritervalues(self):
values = list()

for iocsv in self.indobscsv:
values.append(iocsv.__class__.__name__)
name = iocsv.plotinfo.plotname or iocsv.__class__.__name__
values.append(name)
lio = len(iocsv)
values.append(lio)
if lio:
Expand Down

0 comments on commit b239e7e

Please sign in to comment.