Slope()
<< Click to Display Table of Contents >> Slope() |
Returns a measurement of the steepness of a price series (y value) measured by the change over time (x value). The return value can also be thought of as the ratio between the startBarsAgo and endBarsAgo parameters passed to the method.
The formula which is returned from the parameters passed is:
(series[endBarsAgo] - series[startBarsAgo]) / (startBarsAgo - endBarsAgo)
Note: The return value should NOT be confused with the angle (or radians) of a line that displays on the chart. |
This method returns a double value indicating the slope of a line; A value of 0 returns if the either the startBars or endBars parameters are less than 0 or both parameters are of equal value.
Warning: The "startBarsAgo" parameter MUST be greater than the "endBarsAgo" parameter |
series |
Any Series<double> type object such as an indicator, Close, High, Low, etc... |
startBarsAgo |
The starting point of a series to be evaluated |
endBarsAgo |
The ending point of a series to be evaluated |
Tip: Thinking in degrees, for example a 1 to -1 return range would translate to 45 to -45. To convert you could look into working with this formula - Math.Atan(Slope) * 180 / Math.PI |
protected override void OnBarUpdate() |