From 33e16caa8fc47a4f9b744b59ee317e2733bd0ae7 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 16:18:36 +0530 Subject: [PATCH 1/9] Add files via upload --- Indicator.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Indicator.md diff --git a/Indicator.md b/Indicator.md new file mode 100644 index 00000000..0c703e94 --- /dev/null +++ b/Indicator.md @@ -0,0 +1,51 @@ +--- + +# Indicator's in mplfinance +#### "Indicator" In the world of investing, indicators typically refer to technical chart patterns deriving from the price, volume, or open interest of a given security. + +--- + +## There are two ways to build indicator in mplfinance: +- Building Indicator With addplot Functiona +- Inbuilt Indicator Method (Upcoming Feature) +#### Below is a brief description of each method, with links to tutorials on how to use each method: + +--- +### [Addplot](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb) +* The Addplot Method ***is easy to use and requires little or no knowledge of matplotlib***, and no need to import matplotlib. +* The Addplot With make_addplot handles 95% of the most common types of indicator and market studies. +* The make_addplot Method attains its simplicity, in part, by having certain limitations.
These limitiations are: + - Lenghtly Code Required For Complex Indicators. + - Added Plot Not Provide Ticker On Y-Axis. + - Legend Support Limited. +* The Inbuilt Method is adequate to any kind complex indicator: + - Complex Indicator. + - Legend Fully Supported + - with one or more studies/indicators, such as: + - MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc. +* [**See here for a tutorial and details on implementing the mplfinance for plot indicator.**](https://github.com/matplotlib/mplfinance/tree/master/examples/indicators) + +--- + +### [Indicator Example Available](https://github.com/matplotlib/mplfinance/blob/master/examples/external_axes.ipynb) +* The External Axes method of subplots **allows the user to create and manage their own Figure and Axes (SubPlots), and pass Axes into `mplfinance`**. +* Details on how to use this feature are described below.
  (code examples can be found in the [**External Axes notebook**](https://github.com/matplotlib/mplfinance/blob/master/examples/external_axes.ipynb)). +* When passing `Axes` into `mplfinance`, some `mplfinance` features may be _not_ available, or may behave differently. For example, + - The user is responsible to configure the size and geometry of the Figure, and size and location of the Axes objects within the Figure. + - The user is responsible to display the Figure by calling **`mplfinance.show()`** (or `pyplot.show()`). +* Passing external Axes into `mplfinance` results in more complex code **but it also provides all the power and flexibility of `matplotlib` for those who know how to and what to use it.** This includes: + - plotting on as many subplots as desired, in any geometry desired. + - plotting multiple ohlc/candlestick plots on the same Figure or Axes. + - plotting multiple candlestick plots side-by-side, or in any other geometry desired. + - anitmating or updating plots in real time. + - event handling +* Use method **`mpf.figure()`** to create Figures.
This method behaves exactly like [`pyplot.figure()`](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.pyplot.figure.html) except that **`mpf.figure()`** also accepts kwarg `style=` to set the mplfinance style. +* Call the usual methods for creating Subplot Axes on the figure: + - [fig.add_subplot()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_subplot) + - [fig.add_axes()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_axes) + - [fig.subplots()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.subplots) +* When calling the above subplot creation methods, if `fig` was creating using **`mpf.figure()`** then the Subplot Axes will inheret the mpfinance style information from the figure. Alternatively the user may pass in kwarg `style=` to set different style information for an Axes than for the Figure or other Axes. +* Please note the following: + - Use kwarg **`ax=`** to pass **any matplotlib Axes** that you want into **`mpf.plot()`** + - If you also want to plot volume, **then you must pass in an Axes instance for the volume**,
  so instead of `volume=True`, use **`volume=`**. + - If you specify `ax=` for `mpf.plot()` **then you must also specify** `ax=` **for all calls to `make_addplot()`** From ac8296bbe929cab5d0eb1c72f47f8de16d170c00 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:20:09 +0530 Subject: [PATCH 2/9] Update Indicator.md --- Indicator.md | 88 ++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 40 deletions(-) diff --git a/Indicator.md b/Indicator.md index 0c703e94..c74d03d3 100644 --- a/Indicator.md +++ b/Indicator.md @@ -1,51 +1,59 @@ --- -# Indicator's in mplfinance -#### "Indicator" In the world of investing, indicators typically refer to technical chart patterns deriving from the price, volume, or open interest of a given security. +# Indicators in mplfinance +#### "Indicators" In the world of investing is a vital tool, indicators typically refer to technical chart patterns deriving from the price, volume, or open interest of a given security. --- -## There are two ways to build indicator in mplfinance: -- Building Indicator With addplot Functiona +## There are two ways to build indicators in mplfinance: +- Building a indicator with **`mpf.addplot()`** method - Inbuilt Indicator Method (Upcoming Feature) #### Below is a brief description of each method, with links to tutorials on how to use each method: --- -### [Addplot](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb) -* The Addplot Method ***is easy to use and requires little or no knowledge of matplotlib***, and no need to import matplotlib. -* The Addplot With make_addplot handles 95% of the most common types of indicator and market studies. -* The make_addplot Method attains its simplicity, in part, by having certain limitations.
These limitiations are: - - Lenghtly Code Required For Complex Indicators. - - Added Plot Not Provide Ticker On Y-Axis. - - Legend Support Limited. -* The Inbuilt Method is adequate to any kind complex indicator: - - Complex Indicator. - - Legend Fully Supported - - with one or more studies/indicators, such as: - - MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc. -* [**See here for a tutorial and details on implementing the mplfinance for plot indicator.**](https://github.com/matplotlib/mplfinance/tree/master/examples/indicators) +### [Addplot Method](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb) +* The `mpf.addplot()` Method ***is easy to use and requires little or no knowledge of matplotlib***, and no need to import matplotlib. +* The `mpf.addplot()` with `mpf.make_addplot` handles 95% of the most common types of indicators and market studies. +* The `mpf.make_addplot` method attains its simplicity, in part, by having certain limitations.
These limitations are: + - Large code required for complex indicators. + - Larger calculation required. + - Legend box support Limited. +* The Inbuilt method is adequate for any kind of complex indicator: + - Complex indicators can be handled. + - Legend box fully supported + - With one or more studies/indicators, such as: + - Ichimoku, MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc. +* [**See here for a tutorial and details on implementing the mplfinance for addplot method.**](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb) ---- -### [Indicator Example Available](https://github.com/matplotlib/mplfinance/blob/master/examples/external_axes.ipynb) -* The External Axes method of subplots **allows the user to create and manage their own Figure and Axes (SubPlots), and pass Axes into `mplfinance`**. -* Details on how to use this feature are described below.
  (code examples can be found in the [**External Axes notebook**](https://github.com/matplotlib/mplfinance/blob/master/examples/external_axes.ipynb)). -* When passing `Axes` into `mplfinance`, some `mplfinance` features may be _not_ available, or may behave differently. For example, - - The user is responsible to configure the size and geometry of the Figure, and size and location of the Axes objects within the Figure. - - The user is responsible to display the Figure by calling **`mplfinance.show()`** (or `pyplot.show()`). -* Passing external Axes into `mplfinance` results in more complex code **but it also provides all the power and flexibility of `matplotlib` for those who know how to and what to use it.** This includes: - - plotting on as many subplots as desired, in any geometry desired. - - plotting multiple ohlc/candlestick plots on the same Figure or Axes. - - plotting multiple candlestick plots side-by-side, or in any other geometry desired. - - anitmating or updating plots in real time. - - event handling -* Use method **`mpf.figure()`** to create Figures.
This method behaves exactly like [`pyplot.figure()`](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.pyplot.figure.html) except that **`mpf.figure()`** also accepts kwarg `style=` to set the mplfinance style. -* Call the usual methods for creating Subplot Axes on the figure: - - [fig.add_subplot()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_subplot) - - [fig.add_axes()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.add_axes) - - [fig.subplots()](https://matplotlib.org/3.3.0/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure.subplots) -* When calling the above subplot creation methods, if `fig` was creating using **`mpf.figure()`** then the Subplot Axes will inheret the mpfinance style information from the figure. Alternatively the user may pass in kwarg `style=` to set different style information for an Axes than for the Figure or other Axes. -* Please note the following: - - Use kwarg **`ax=`** to pass **any matplotlib Axes** that you want into **`mpf.plot()`** - - If you also want to plot volume, **then you must pass in an Axes instance for the volume**,
  so instead of `volume=True`, use **`volume=`**. - - If you specify `ax=` for `mpf.plot()` **then you must also specify** `ax=` **for all calls to `make_addplot()`** +### [Following Example of Indicators](https://github.com/matplotlib/mplfinance/blob/master/examples/external_axes.ipynb) +* [**The Alphatrend Indicator**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/alphatrend.ipynb) + - For Building Alphatrend Indicator with `make_addplot`. This method helps plot two lines, named k1 and k2. The area between two lines is filled with `fill_between` method. For color conditional formatting we use the `where`. + - Details on how to implement Alphatrend Indicator Over are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/alphatrend.ipynb)) +* [**Awesome Oscillator**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/awesome_oscillator.ipynb) + - Use method `make_addplot` method Awesome Oscillator Build as Histogram Bar type of plot `bar` in a new panel with `panel` method + - Details on how to implement Awesome Oscillator is described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/awesome_oscillator.ipynb)) +* [**Dochian Channel**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/donchian_channel.ipynb) + - For Building Dochian Channel with `make_addplot`. This method helps plot three lines in this indicator, named upper, middle, and lower bands. The area between the upper and lower band is filled with `fill_between` method. + - Details on how to implement Dochian Channel Over are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/donchian_channel.ipynb)) +* [**Golden Cross Over**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/golden_cross.ipynb) + - For Building Golden Cross with `make_addplot` we use two moving averages named short-term moving averages and long-term moving averages. When One Line Cross another that point is marked with `marker` with type `scatter`. while to change the color of the long-term moving average we use a custom function. + - Details on how to implement Golden Cross Over are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/golden_cross.ipynb)) +* [**Ichimoku Cloud**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/ichimoku_cloud.ipynb) + - For Building Ichimoku Cloud with `make_addplot`. The following method helps to plot Five lines used in this indicator, named Tenkan-sen, Kijun-sen, Senkou_Span_A, Senkou_Span_B, Chikou_Span. The area between the Senkou_Span_A and Senkou_Span_B is filled with `fill_between` method. + - Details on how to implement Ichimoku Cloud are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/ichimoku_cloud.ipynb)) +* [**MACD**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/macd.py) + - Use method `make_addplot` MACD is built as Histogram Bar type of plot `bar` in a new panel with `panel` method + - Details on how to implement MACD are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/macd.py)) +* [**MACD Histogram**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/macd_histogram_gradient.ipynb) + - Use method `make_addplot` MACD with Histogram is built as Histogram Bar type of plot `bar` in a new panel with `panel` method. For Generating a color list for the histogram we use the custom function. + - Details on how to implement MACD Histogram are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/macd_histogram_gradient.ipynb)) +* [**Relative Strength Index**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/mpf_rsi_demo.py) + - Use methods `make_addplot` and `panel` were used to plot rsi + - Details on how to implement Relative Strength Index are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/parabolic_sar.ipynb)) +* [**Parabolic SAR**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/mpf_rsi_demo.py) + - For Building Parabolic SAR with `make_addplot`. This method helps plot two lines in this indicator, named upper and lower bands. The custom function is used to segregate uptrend and down-trending areas. Which later plot with type `scatter` + - Details on how to implement Parabolic SAR are described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/parabolic_sar.ipynb)) +* [**Supertrend**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/supertrend.ipynb) + - For Building Supertrend with `make_addplot`. This method helps plot three lines in this indicator, named upper, trendline, and lower bands. when the price is above the trendline area marked uptrend and downtrend with a custom function, The area between the upper band and high of the candle is filled with `fill_between` method. + - Details on how to implement Supertrend described below.
  (code examples can be found in the [**examples/indicators/**](https://github.com/matplotlib/mplfinance/blob/master/examples/indicators/supertrend.ipynb)) From a1b2f347bd3ff8db9b124b46fa9d298a9c6279f1 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:22:55 +0530 Subject: [PATCH 3/9] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 391b8c58..8d336b90 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ pip install --upgrade mplfinance - **[Customizing the Appearance of Plots](https://github.com/matplotlib/mplfinance/blob/master/markdown/customization_and_styles.md)** - **[Adding Your Own Technical Studies to Plots](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb)** - **[Subplots: Multiple Plots on a Single Figure](https://github.com/matplotlib/mplfinance/blob/master/markdown/subplots.md)** + - **[Implementing Indicators ](https://github.com/matplotlib/mplfinance/blob/master/markdown/indicator.md)** - **[Fill Between: Filling Plots with Color](https://github.com/matplotlib/mplfinance/blob/master/examples/fill_between.ipynb)** - **[Price-Movement Plots (Renko, P&F, etc)](https://github.com/matplotlib/mplfinance/blob/master/examples/price-movement_plots.ipynb)** - **[Trends, Support, Resistance, and Trading Lines](https://github.com/matplotlib/mplfinance/blob/master/examples/using_lines.ipynb)** From 9ec44ca2382d3d5f1873ba8ccce6fdb5692be350 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:28:06 +0530 Subject: [PATCH 4/9] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8d336b90..4504b08a 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ pip install --upgrade mplfinance - **[Customizing the Appearance of Plots](https://github.com/matplotlib/mplfinance/blob/master/markdown/customization_and_styles.md)** - **[Adding Your Own Technical Studies to Plots](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb)** - **[Subplots: Multiple Plots on a Single Figure](https://github.com/matplotlib/mplfinance/blob/master/markdown/subplots.md)** - - **[Implementing Indicators ](https://github.com/matplotlib/mplfinance/blob/master/markdown/indicator.md)** + - **[Implementing Indicators ](https://github.com/matplotlib/mplfinance/blob/master/markdown/Indicator.md)** - **[Fill Between: Filling Plots with Color](https://github.com/matplotlib/mplfinance/blob/master/examples/fill_between.ipynb)** - **[Price-Movement Plots (Renko, P&F, etc)](https://github.com/matplotlib/mplfinance/blob/master/examples/price-movement_plots.ipynb)** - **[Trends, Support, Resistance, and Trading Lines](https://github.com/matplotlib/mplfinance/blob/master/examples/using_lines.ipynb)** @@ -58,7 +58,7 @@ where `data` is a `Pandas DataFrame` object containing Open, High, Low and Close Details on how to call the new API can be found below under **[Basic Usage](https://github.com/matplotlib/mplfinance#usage)**, as well as in the jupyter notebooks in the **[examples](https://github.com/matplotlib/mplfinance/blob/master/examples/)** folder. -I am very interested to hear from you regarding what you think of the new `mplfinance`, plus any suggestions you may have for improvement. You can reach me at **dgoldfarb.github@gmail.com** or, if you prefer, provide feedback or a ask question on our **[issues page.](https://github.com/matplotlib/mplfinance/issues/new/choose)** +I am very interested to hear from you regarding what you think of the new `mplfinance`, plus any suggestions you may have for improvement. You can reach me at **dgoldfarb.github@gmail.com** or, if you prefer, provide feedback or ask a question on our **[issues page.](https://github.com/matplotlib/mplfinance/issues/new/choose)** --- From 5d7304567e380f436441cf7d4fcb32b3e46cd258 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:32:00 +0530 Subject: [PATCH 5/9] Update TODO.md --- TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 0d0b5bb2..1d95874b 100644 --- a/TODO.md +++ b/TODO.md @@ -5,7 +5,7 @@ - how use configuration file - auto-pull updates for config file. possible? - collect anonymous data on feature usage -- wrappers for technical studies. +- wrappers for technical studies(Under Development..... Please Suggest a Wishlist of Technical Studies Required as enhancement ). - documentation (replace old `https://matplotlib.org/api/finance_api.html`) - make code more efficient (ex: tlines reconstructing data frame). - **daily plot slower than intraday ???** From d1104623c6397bafb8981cba1d7b84c65977954b Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 19:39:04 +0530 Subject: [PATCH 6/9] File Migrated --- Indicator.md => markdown/Indicator.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Indicator.md => markdown/Indicator.md (100%) diff --git a/Indicator.md b/markdown/Indicator.md similarity index 100% rename from Indicator.md rename to markdown/Indicator.md From ca751f9729eb8f7a38cb2e84446797765f79fe34 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:10:00 +0530 Subject: [PATCH 7/9] Okay --- markdown/Indicator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/markdown/Indicator.md b/markdown/Indicator.md index c74d03d3..ab956aa1 100644 --- a/markdown/Indicator.md +++ b/markdown/Indicator.md @@ -22,7 +22,7 @@ - Complex indicators can be handled. - Legend box fully supported - With one or more studies/indicators, such as: - - Ichimoku, MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc. + - Ichimoku Cloud, MACD, DMI, RSI, Bollinger, Accumulation/Distribution Oscillator, Commodity Channel Index, Etc. * [**See here for a tutorial and details on implementing the mplfinance for addplot method.**](https://github.com/matplotlib/mplfinance/blob/master/examples/addplot.ipynb) From cb7f97eb7cd1a2306552a43593e44216d61b5e50 Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:24:24 +0530 Subject: [PATCH 8/9] Version Updated Version Updated --- src/mplfinance/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mplfinance/_version.py b/src/mplfinance/_version.py index 9929be97..a1ffffa0 100644 --- a/src/mplfinance/_version.py +++ b/src/mplfinance/_version.py @@ -1,4 +1,4 @@ -version_info = (0, 12, 9, 'beta', 8) +version_info = (0, 12, 9, 'beta', 8.1) _specifier_ = {'alpha': 'a','beta': 'b','candidate': 'rc','final': ''} From d5b91987df2e95d796b7d4d9846d56cc21d072ec Mon Sep 17 00:00:00 2001 From: "Dr. Chandrakant Bangar" <127198654+DrChandrakant@users.noreply.github.com> Date: Wed, 14 Jun 2023 23:26:04 +0530 Subject: [PATCH 9/9] Version Update Version Update --- src/mplfinance/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mplfinance/_version.py b/src/mplfinance/_version.py index a1ffffa0..bc874c3c 100644 --- a/src/mplfinance/_version.py +++ b/src/mplfinance/_version.py @@ -1,4 +1,4 @@ -version_info = (0, 12, 9, 'beta', 8.1) +version_info = (0, 12, 9, 'beta', 9) _specifier_ = {'alpha': 'a','beta': 'b','candidate': 'rc','final': ''}