This script calculates the "instantaneous" first and second derivatives in a highly flexible and accurate way: namely, via zero-lag price tracking with increasingly narrow sample windows for sequential secant approximation tending towards the tangent. The slope of this tangential is the first derivative, i.e., slope.
Paired with a divergence indicator this can be a powerful tool for trend analysis.
The Script Works As Follows
The slope (first derivative) is represented in line form
Note that crossing through zero, the slope indicates a change in trend direction.
The concavity (second derivative) is represented in histogram form
Positive concavity indicates a shape like an upward bowl, negative is like a downward bowl, and crossing through zero is an inflection point.
Pair this with any indicator that will accept arbitrary input (i.e., from other indicators) select slope or concavity (first or second derivative) to get a lead on trend changes that are often difficult to approximate with the eye during hectic markets.
This is particularly useful as an augmentation for trend shift indicator -- which has been updated.
Hi @BradfordFournier , hope you're doing well. I have been using your slope derivative calculation for several months and it has quite changed my trading game. Big Thanks ). In having used this for a good while, I think adding a probable boundary/levels on either side of the zero-line would be of much help visually. ie: adding levels on both sides of the zero-lines, say at +50 and -50. This may probably help the trader identify when the slope is about to move down from the extreme-top readings and vice versa. For example, most Stochastic oscillators have a levels on top and bottom to pick out extreme readings. I hope it helps! Thanks very much again!
PaulRacG
⋅
This doesn't seem to work as well for Bitcoin as it does with stocks, ETFs, and most other cryptos. Are there some special recommended inputs for use on Bitcoin?
Zayed11
⋅
Oops , powerful wosome indecator ....where is the script??
JDtradingCharts
⋅
Could you give me some tips how i can programm similar indicator ?
UnknownUnicorn11363932
⋅
Great! The good thing would be to add a possibility to choose any type of source. For now the source is price data (close price?). Price is really very hectic, so indicator seems like ragged basing on price data. For example, if I have 20 days SMA, it would be nice to catch inflection points in it (2nd derivative) and track trends slowdowns with possible reversal. So inflection points would be a nice place to start making orders gradually.
Constanpips_thegreat
⋅
In your description you write “ Pair this with any indicator that will accept arbitrary input (i.e., from other indicators)” but TradingView won’t allow me to add this to another indicator.
Would love if you opened the code for this but I get it. Do you have any resources that could help a non math-oriented person learn the mathematical concepts behind the code at least.