Skip to content

Bug Report: #568

Closed
Closed
@amitgupta16033

Description

@amitgupta16033

Hi,

The calculation of 'pnf_counts' is incorrect. Hence, leading to incorrect plotting. I am attaching the out of mplfinance as well the correct chart from 'Stockcharts.com'. Following parameters were used -

Box Size = 180
Reversal =3

Code excerpts -

data1 = data.loc[:, ['Date', 'Open', 'High', 'Low', 'Close', 'Volume']]
datanew = data1.set_index(['Date']).astype(float)
pnf_kwargs = dict(type='pnf', volume=True, figratio=(1, 1), figscale=5)
cv = {} # blank dict to hold return_calculated_values values
close_last_value = int(data1['Close'].iloc[-1])
pnf_box_size = round(close_last_value * 0.01)
print("Box_Size is - " + str(pnf_box_size))
pnf_reversal = 3
print("Reversal is - " + str(pnf_reversal))
mf.plot(datanew, **pnf_kwargs, style='starsandstripes', pnf_params=dict(box_size=pnf_box_size, reversal=pnf_reversal),
return_calculated_values=cv)
col_value = cv.get('pnf_counts')
print(col_value)

Could you please provide us a solution? I am also attaching images and for your reference.
https://drive.google.com/file/d/1vpa8e7mI3GGpQTnQdJE5YpLWyNWHh8Pu/view?usp=share_link
https://drive.google.com/file/d/1_ZpgnahDxZGLQpVIH2kNML_zBxLN_VqH/view?usp=share_link
https://docs.google.com/spreadsheets/d/16SpG7Waq19as98-5CnME9EyefPzdGoRG/edit?usp=share_link&ouid=115874185577837631247&rtpof=true&sd=true

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleasedcode merged into repo AND released to Pypi

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions