Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNF return_calculated_values --> miny / maxy not correct #624

Open
Pipsopath opened this issue Jun 7, 2023 · 5 comments
Open

PNF return_calculated_values --> miny / maxy not correct #624

Pipsopath opened this issue Jun 7, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@Pipsopath
Copy link

Pipsopath commented Jun 7, 2023

I have noticed the miny / maxy might not be correct in the return_calculated_values of PNF (maybe in renko as well?)

The returned values:

miny 137.33999633789065
maxy 181.83999633789065

The chart:

pnf chart

Further, how is minx and maxx to be interpreted, as the x-achis is a timeline, but the values are decimal?
minx -0.9777777777777777
maxx 44.977777777777774

@Pipsopath Pipsopath added the bug Something isn't working label Jun 7, 2023
@Pipsopath Pipsopath changed the title PNF return_calculated_values --> miny / minx not correct PNF return_calculated_values --> miny / maxy not correct Jun 7, 2023
@DanielGoldfarb
Copy link
Collaborator

DanielGoldfarb commented Jun 7, 2023

minx,maxx to be interpreted as the "column number" that is furthest to the left and furthest to right, respectively, on the x-axis. (In your example, the actual first column may be plotted at approximately 0.0, the x-axis starts at -0.97). The actual dates (for the columns) are returned as ['pnf_dates' ] in the calculated values dict, and thus the minx date and maxx date would be the first and last elements of that list.

will look into the miny,maxy issue.

@Pipsopath
Copy link
Author

Pipsopath commented Jun 7, 2023

Another issue, which I now relate to this observation is, that if i plot as tight_layout, then it doesn't plot the complete range. I guess this is an resulting error from the wrong miny and maxy:

tight_layout = true
pnf chart - tight

tight_layout = false
pnf chart

@DanielGoldfarb
Copy link
Collaborator

hmm. yes, that's a problem. the type of matplotlib axis objects that mplfinance uses do not support matplotlib's tight_layout, therefore mplfinance internally implements its own tight_layout, and obviously the existing algorithm doesn't work correctly for pnf and renko plots. as you mentioned, this probably related (whole or in part) to the calculation of min and max y.

@DanielGoldfarb
Copy link
Collaborator

I am unable to reproduce the maxy,miny and tight_layout issue. Perhaps it is data related. Can you please post your data as a csv file, and code, to reproduce the above plots?

@Pipsopath
Copy link
Author

Please find attached the code and the data.
Sorry, could not figure out how to provide the code in a proper way than as text file

pnf plot bug.txt
_AAPL_H1.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants