Skip to content

TypeError: object of type 'int' has no len() - renko with return_calculated_values and mav #394

Open
@camstuart

Description

@camstuart

Hello,

Firstly i'd like to say this is an excellent library, very very good indeed, and I really appreciate the work done here.

I am using the return_calculated_values feature so I can test (and hopefully add to the plot) my own studies that are based on the renko data.

I am using python 3.7 on Google Colab, the following code works perfectly, and retvals is populated:

retvals = {}
mpf.plot(df, type='renko', return_calculated_values=retvals,
         title=f'ADAUSDT / Renko Chart (1m base)',
         renko_params=dict(brick_size='atr', atr_length=10),
         style='yahoo', figratio=(35,12),figscale=1.8
)

However, adding mav=10 or mav=(10) generates an error:

retvals = {}
mpf.plot(df, type='renko', return_calculated_values=retvals, mav=(10),
         title=f'ADAUSDT / Renko Chart (1m base)',
         renko_params=dict(brick_size='atr', atr_length=10),
         style='yahoo', figratio=(35,12),figscale=1.8
)

TypeError                                 Traceback (most recent call last)
<ipython-input-72-29c81de85c1f> in <module>()
      5          title=f'ADAUSDT / Renko Chart (1m base)',
      6          renko_params=dict(brick_size='atr', atr_length=10),
----> 7          style='yahoo', figratio=(35,12),figscale=1.8
      8 )

/usr/local/lib/python3.7/dist-packages/mplfinance/plotting.py in plot(data, **kwargs)
    483         if config['mav'] is not None:
    484             mav = config['mav']
--> 485             if len(mav) != len(mavprices):
    486                 warnings.warn('len(mav)='+str(len(mav))+' BUT len(mavprices)='+str(len(mavprices)))
    487             else:

TypeError: object of type 'int' has no len()

Dependencies:

mplfinance in /usr/local/lib/python3.7/dist-packages (0.12.7a17)
pandas in /usr/local/lib/python3.7/dist-packages (from mplfinance) (1.1.5)
matplotlib in /usr/local/lib/python3.7/dist-packages (from mplfinance) (3.2.2)
numpy>=1.15.4 in /usr/local/lib/python3.7/dist-packages (from pandas->mplfinance) (1.19.5)
pytz>=2017.2 in /usr/local/lib/python3.7/dist-packages (from pandas->mplfinance) (2018.9)
python-dateutil>=2.7.3 in /usr/local/lib/python3.7/dist-packages (from pandas->mplfinance) (2.8.1)
pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mplfinance) (2.4.7)
kiwisolver>=1.0.1 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mplfinance) (1.3.1)
cycler>=0.10 in /usr/local/lib/python3.7/dist-packages (from matplotlib->mplfinance) (0.10.0)
six>=1.5 in /usr/local/lib/python3.7/dist-packages (from python-dateutil>=2.7.3->pandas->mplfinance) (1.15.0)

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions