-
Notifications
You must be signed in to change notification settings - Fork 658
Add Point and Figure parameter to customize number of boxes needed to reverse the trend #370
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
Conversation
Update fork with latest version from origin
@coffincw I observed on the Bloomberg system that they allow reversal to be any integer from 1 to 9. I also observed that, for some charts, when the reversal amount gets large (for example reversal=7, or 8 or 9) then the chart displays only a single column, or a just a few columns, and the charts for reversal=7 or 8 or 9 are all identical. Other charts do show some difference for the larger reversal settings. (Apparently the behavior depends at least somewhat on the data itself). At any rate, being very much a novice myself at PnF charts, I would like to understand the exact nature of the limitations at both the low and the high end of possible reversal settings. Thanks. --Daniel |
@DanielGoldfarb I actually wasn't sure whether the existing reversal value was 1 or 2 since it requires two full boxes of price movement in the opposite direction to switch the trend direction. But since Bloomberg considers this to be reversal =1 I can easily adjust the values. Regarding the upper limitations of the reversal value I settled on limiting the brick_size * reversal to be < 30% of the closing range, but if Bloombergs system allows reversal periods 1-9 we should probably go with that too. Let me know what you think. |
Caleb, |
Merge with upstream
Allowed for reversal values of 1-9, but I found a new bug while testing. I'm hoping to have some time to take a look at it in the next few days. |
Thanks. Looking forward to it. |
Previous implementation didn't account for the movement after the last reversal. This led to issues with both the final box value and the final column volume data. This change adds logic to track any further movement (volume and box) in the same signed direction after the final reversal and adds it to the last box column after the clean data loop.
It's good to fork and test. Let me know if you run into any issues. |
The reversal was previously configured to be two boxes. With this new parameter, you can customize the reversal value as long as it's >= 2 and the product of the box_size and the reversal does not exceed 30% of the close price range of the dataset.
Here is an example:
mpf.plot(df,type='pnf',pnf_params=dict(box_size='atr',atr_length='total', reversal=3),mav=(4,6,8),volume=True)
Closes #368