Reputation: 65
I am trying to get the ATR for each of the stocks I am plotting (renko & PNF) but get an error. Following is the code I am using which is basically the same as what I found on Github for "return_calculated_values."
https://github.com/matplotlib/mplfinance/issues/135
ChartATR = 14 ###### atr_length=ChartATR retvals = ()
try:
ThisChart = 'Charts\\' + ThisStock + '-renko.png'
ThisChartTitle = '\n ' + ThisStock + ' - renko' + " " + Dayte
# ====> The next line of code works <====================================================
mpf.plot(year,type='renko', renko_params=dict(brick_size='atr', atr_length=ChartATR),savefig = ThisChart, title = ThisChartTitle)
# ====>This next line of code does not work (generates the error <===========================================
mpf.plot(year,type='renko', renko_params=dict(brick_size='atr', atr_length=ChartATR), return_calculated_values=retvals)
# print('ATR =',retvals[size]) # This generates an error <==========================
print('ATR =',retvals)
except:
print("An error occured processing " + ThisStock)
print()
I appreciate any help or thoughts.
Thanks, Manny
Upvotes: 2
Views: 406
Reputation: 65
Problem solved:
retvals = () should be a dictionary: retvals = {}, and needs to be cleared with each pass
Upvotes: 1