Skip to content

Commit

Permalink
chore: update docs (#896)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSkender committed Sep 17, 2022
1 parent c861415 commit 315f2df
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 107 deletions.
4 changes: 2 additions & 2 deletions docs/_indicators/AtrStop.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ IEnumerable<AtrStopResult>
| -- |-- |--
| `Date` | DateTime | Date
| `AtrStop` | decimal | ATR Trailing Stop line contains both Upper and Lower segments
| `BuyStop` | decimal | Upper band only (bearish/red)
| `SellStop` | decimal | Lower band only (bullish/green)
| `BuyStop` | decimal | Upper band only (green)
| `SellStop` | decimal | Lower band only (red)

`BuyStop` and `SellStop` values are provided to differentiate buy vs sell stop lines and to clearly demark trend reversal. `AtrStop` is the contiguous combination of both upper and lower line data.

Expand Down
2 changes: 1 addition & 1 deletion docs/_indicators/Hurst.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ layout: indicator

# {{ page.title }}

The [Hurst Exponent](https://en.wikipedia.org/wiki/Hurst_exponent) ('H') is a [random-walk](https://en.wikipedia.org/wiki/Random_walk) path analysis that measures trending and mean-reverting tendencies of incremental return values. When `H` is greater than 0.5 it depicts trending. When `H` is less than 0.5 it is is more likely to revert to the mean. When `H` is around 0.5 it represents a random walk.
The [Hurst Exponent](https://en.wikipedia.org/wiki/Hurst_exponent) (`H`) is part of a Rescaled Range Analysis, a [random-walk](https://en.wikipedia.org/wiki/Random_walk) path analysis that measures trending and mean-reverting tendencies of incremental return values. When `H` is greater than 0.5 it depicts trending. When `H` is less than 0.5 it is is more likely to revert to the mean. When `H` is around 0.5 it represents a random walk.
[[Discuss] :speech_balloon:]({{site.github.repository_url}}/discussions/477 "Community discussion about this indicator")

![image]({{site.baseurl}}{{page.image}})
Expand Down
2 changes: 1 addition & 1 deletion docs/_indicators/Slope.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ IEnumerable<SlopeResult> results =

| name | type | notes
| -- |-- |--
| `lookbackPeriods` | int | Number of periods (`N`) for the linear regression. Must be greater than 0.
| `lookbackPeriods` | int | Number of periods (`N`) for the linear regression. Must be greater than 1.

### Historical quotes requirements

Expand Down
Binary file modified docs/examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/examples.webp
Binary file not shown.
1 change: 1 addition & 0 deletions docs/examples/CustomIndicators/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Custom Indicators
description: The Stock Indicators for .NET library includes extra features to make it easy for you to extend and to add your own custom indicators. Here's an example.
permalink: /custom-indicators/
relative_path: examples/CustomIndicators/README.md
layout: page
Expand Down
1 change: 1 addition & 0 deletions docs/examples/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Example usage code
description: The Stock Indicators for .NET library is a simple yet flexible tool to help you build your financial market systems. Here's a few complete working examples that you can download and try yourself.
permalink: /examples/
relative_path: examples/README.md
layout: page
Expand Down
196 changes: 100 additions & 96 deletions docs/performance.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/utilities.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Utilities and helpers
description: The Stock Indicators for .NET library includes utilities to help you use and transform historical prices quotes and indicator results. We have also made available the internal tools the methods we use, to help when creating your own custom indicators.
description: The Stock Indicators for .NET library includes utilities to help you use and transform historical prices quotes and indicator results, and to create custom indicators.
permalink: /utilities/
relative_path: utilities.md
layout: page
Expand Down Expand Up @@ -172,7 +172,7 @@ This library also includes several tools that we use internally to calculate ind

| method | example usage
| -- |--
| Slope | `double[] xValues = { 1, 2, 5, 4, 1 };`<br>`double[] yValues = { 4, 7, 8, 1, 1 };`<br>`double slope = Slope(xValues, yValues);`
| Slope | `double[] xValues = { 1, 2, 5, 4, 1 };`<br>`double[] yValues = { 4, 7, 8, 1, 1 };`<br>`double slope = Numerics.Slope(xValues, yValues);`
| Standard deviation | `double[] values = { 1, 2, 3, 4, 5 };`<br>`double sd = values.StdDev();`

### NullMath
Expand Down
Binary file modified src/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions src/s-z/Slope/Slope.Series.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static List<SlopeResult> CalcSlope(
double sumX = 0;
double sumY = 0;

for (int p = i + 1 - lookbackPeriods; p <= i; p++)
for (int p = i - lookbackPeriods + 1; p <= i; p++)
{
(DateTime _, double pValue) = tpList[p];

Expand All @@ -49,7 +49,7 @@ internal static List<SlopeResult> CalcSlope(
double sumSqY = 0;
double sumSqXY = 0;

for (int p = i + 1 - lookbackPeriods; p <= i; p++)
for (int p = i - lookbackPeriods + 1; p <= i; p++)
{
(DateTime _, double pValue) = tpList[p];

Expand Down Expand Up @@ -95,10 +95,10 @@ private static void ValidateSlope(
int lookbackPeriods)
{
// check parameter arguments
if (lookbackPeriods <= 0)
if (lookbackPeriods <= 1)
{
throw new ArgumentOutOfRangeException(nameof(lookbackPeriods), lookbackPeriods,
"Lookback periods must be greater than 0 for Slope/Linear Regression.");
"Lookback periods must be greater than 1 for Slope/Linear Regression.");
}
}
}
2 changes: 1 addition & 1 deletion tests/indicators/s-z/Slope/Slope.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ public void Removed()
[TestMethod]
public void Exceptions()
=> Assert.ThrowsException<ArgumentOutOfRangeException>(()
=> Indicator.GetSlope(quotes, 0));
=> quotes.GetSlope(1));
}

0 comments on commit 315f2df

Please sign in to comment.