matplotlib / matplotlib/mplfinance

PnF Reversal Bug

オープン
#671 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

bug
主要言語
Python
スター
4.4k
フォーク
678
PR マージ指標
30日以内にマージされた PR はありません

説明

Hi,

Firstly thanks for this awesome resource. This is my first time contributing to GitHub (I have much to learn re. push / pull / commit etc. thats for another day) so please be kind.

BUG:
I've been plotting pnf charts and experimenting with different reversal thresholds.
Regardless of variable submitted (tried 1-9) I always produce the same graph. Have tried with differenet slices of my dataframe, different box sizes etc. and the same behavior occurs.

Expected behavior:
Lower reversal thresholds should result in a noisier PnF chart. i.e more columns with less x's o's in the smallest.

Suspected Fix (I'm a noob so maybe way off):
Suspect the issue lies in -utils.py, _pnf_calculator, rows 1373 & 1395 which appear to reset the reverse threshold basd on: current_level +- 3* boxsize, where I think it should be "current_level +-'reverse' *boxsize", where reverse is passed into the function (row 1304 (default 3).

I think you may need to adjust with addition of "current reversal threshold" which calcs each time round the loop, based on retained reverse value (default 3) passed to the function as kwarg, if that makes sense?

Screenshot:
![image](https://github.com/matplotlib/mplfinance/assets/123564203/cd1d34f6-d920-448e-bdb9-438a82143f4d)

Trust this is of value to the community.
(In time I'll learn to contribute directly. One step at a time on my learning journey though...)
Best
W-Smurf

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

反転値を1から9まで変えてPnFチャートを再現し、結果を比較します。utils.py の _pnf_calculator、特に1373行目と1395行目を調べ、1304行目付近の reverse 引数を追跡します。反転しきい値を変更すると、それに応じて異なるPnFチャートが生成されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
matplotlib, python
領域
data-visualization
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。