-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd24d59
commit b5fa2f2
Showing
79 changed files
with
447 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: ATR Trailing Stop | ||
description: Created by Welles Wilder, the ATR Trailing Stop indicator attempts to determine the primary trend of financial market prices by using Average True Range (ATR) band thresholds. It can indicate a buy/sell signal or a trailing stop when the trend changes. | ||
permalink: /indicators/AtrStop/ | ||
type: price-trend | ||
layout: indicator | ||
--- | ||
|
||
# {{ page.title }} | ||
|
||
><span class="indicator-syntax">**get_atr_stop**(*quotes, lookback_periods=21, multiplier=3, end_type=EndType.CLOSE*)</span> | ||
## Parameters | ||
|
||
| name | type | notes | ||
| -- |-- |-- | ||
| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). <br><span class='qna-dataframe'> • [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame</span> | ||
| `lookback_periods` | int, *default 21* | Number of periods (`N`) for the ATR evaluation. Must be greater than 1. | ||
| `multiplier` | float, *default 3* | Multiplier sets the ATR band width. Must be greater than 0 and is usually set around 2 to 3. | ||
| `end_type` | EndType, *default EndType.Close* | Determines whether `Close` or `High/Low` is used as basis for stop offset. See [EndType options](#endtype-options) below. | ||
|
||
### Historical quotes requirements | ||
|
||
You must have at least `N+100` periods of `quotes` to cover the convergence periods. Since this uses a smoothing technique, we recommend you use at least `N+250` periods prior to the intended usage date for optimal precision. | ||
|
||
`quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. | ||
|
||
### EndType options | ||
|
||
```python | ||
from stock_indicators.indicators.common.enums import EndType | ||
``` | ||
|
||
| type | description | ||
|-- |-- | ||
| `CLOSE` | Stop offset from `Close` price (default) | ||
| `HIGH_LOW` | Stop offset from `High` or `Low` price | ||
|
||
## Returns | ||
|
||
```python | ||
AtrStopResults[AtrStopResult] | ||
``` | ||
|
||
- This method returns a time series of all available indicator values for the `quotes` provided. | ||
- `AtrStopResults` is just a list of `AtrStopResult`. | ||
- It always returns the same number of elements as there are in the historical quotes. | ||
- It does not return a single incremental indicator value. | ||
- The first `N` periods will have `None` AtrStop values since there's not enough data to calculate. | ||
|
||
>⚞ **Convergence warning**: the line segment before the first reversal and the first `N+100` periods are unreliable due to an initial guess of trend direction and precision convergence for the underlying ATR values. | ||
### AtrStopResult | ||
|
||
| name | type | notes | ||
| -- |-- |-- | ||
| `date` | datetime | Date | ||
| `atr_stop` | Decimal, Optional | ATR Trailing Stop line contains both Upper and Lower segments | ||
| `buy_stop` | Decimal, Optional | Upper band only (green) | ||
| `sell_stop` | Decimal, Optional | Lower band only (red) | ||
|
||
`buy_stop` and `sell_stop` values are provided to differentiate buy vs sell stop lines and to clearly demark trend reversal. `atr_stop` is the contiguous combination of both upper and lower line data. | ||
|
||
### Utilities | ||
|
||
- [.condense()]({{site.baseurl}}/utilities#condense) | ||
- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) | ||
- [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) | ||
- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) | ||
|
||
See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. | ||
|
||
## Example | ||
|
||
```python | ||
from stock_indicators import indicators | ||
|
||
# This method is NOT a part of the library. | ||
quotes = get_historical_quotes("SPY") | ||
|
||
# calculate 21-period ATR Stop | ||
results = indicators.get_atr_stop(quotes) | ||
``` | ||
|
||
## About {{ page.title }} | ||
|
||
Created by Welles Wilder, the ATR Trailing Stop indicator attempts to determine the primary trend of Close prices by using [Average True Range (ATR)]({{site.baseurl}}/indicators/Atr/#content) band thresholds. It can indicate a buy/sell signal or a trailing stop when the trend changes. | ||
[[Discuss] 💬]({{site.dotnet.repo}}/discussions/724 "Community discussion about this indicator") | ||
|
||
![chart for {{page.title}}]({{site.dotnet.charts}}/AtrStop.png) | ||
|
||
|
||
### Sources | ||
|
||
- [C# core]({{site.dotnet.src}}/a-d/AtrStop/AtrStop.Series.cs) | ||
- [Python wrapper]({{site.python.src}}/atr_stop.py) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: Chande Momentum Oscillator (CMO) | ||
description: The Chande Momentum Oscillator is a momentum indicator depicting the weighted percent of higher prices in financial markets. | ||
permalink: /indicators/Cmo/ | ||
type: oscillator | ||
layout: indicator | ||
--- | ||
|
||
# {{ page.title }} | ||
|
||
><span class="indicator-syntax">**get_cmo**(*quotes, lookback_periods*)</span> | ||
## Parameters | ||
|
||
| name | type | notes | ||
| -- | -- | -- | ||
| `quotes` | Iterable[Quote] | Iterable of the [Quote class]({{site.baseurl}}/guide/#historical-quotes) or [its sub-class]({{site.baseurl}}/guide/#using-custom-quote-classes). <br><span class='qna-dataframe'> • [See here]({{site.baseurl}}/guide/#using-pandasdataframe) for usage with pandas.DataFrame</span> | ||
| `lookback_periods` | int | Number of periods (`N`) in the lookback window. Must be greater than 0. | ||
|
||
### Historical quotes requirements | ||
|
||
You must have at least `N+1` periods of `quotes` to cover the warmup periods. | ||
|
||
`quotes` is an `Iterable[Quote]` collection of historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See [the Guide]({{site.baseurl}}/guide/#historical-quotes) for more information. | ||
|
||
## Returns | ||
|
||
```python | ||
CMOResults[CMOResult] | ||
``` | ||
|
||
- This method returns a time series of all available indicator values for the `quotes` provided. | ||
- `CMOResults` is just a list of `CMOResult`. | ||
- It always returns the same number of elements as there are in the historical quotes. | ||
- It does not return a single incremental indicator value. | ||
- The first `N` periods will have `None` values for CMO since there's not enough data to calculate. | ||
|
||
### CmoResult | ||
|
||
| name | type | notes | ||
| -- |-- |-- | ||
| `date` | datetime | Date | ||
| `cmo` | float, Optional | Chande Momentum Oscillator | ||
|
||
### Utilities | ||
|
||
- [.condense()]({{site.baseurl}}/utilities#condense) | ||
- [.find(lookup_date)]({{site.baseurl}}/utilities#find-indicator-result-by-date) | ||
- [.remove_warmup_periods()]({{site.baseurl}}/utilities#remove-warmup-periods) | ||
- [.remove_warmup_periods(qty)]({{site.baseurl}}/utilities#remove-warmup-periods) | ||
|
||
See [Utilities and Helpers]({{site.baseurl}}/utilities#utilities-for-indicator-results) for more information. | ||
|
||
## Example | ||
|
||
```python | ||
from stock_indicators import indicators | ||
|
||
# This method is NOT a part of the library. | ||
quotes = get_historical_quotes("SPY") | ||
|
||
results = indicators.get_cmo(quotes, lookback_periods) | ||
``` | ||
|
||
## About {{ page.title }} | ||
|
||
Created by Tushar Chande, the [Chande Momentum Oscillator](https://www.investopedia.com/terms/c/chandemomentumoscillator.asp) is a weighted percent of higher prices over a lookback window. | ||
[[Discuss] 💬]({{site.dotnet.repo}}/discussions/892 "Community discussion about this indicator") | ||
|
||
![chart for {{page.title}}]({{site.dotnet.charts}}/Cmo.png) | ||
|
||
### Sources | ||
|
||
- [C# core]({{site.dotnet.src}}/a-d/Cmo/Cmo.Series.cs) | ||
- [Python wrapper]({{site.python.src}}/cmo.py) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.