This is an example of one form that I picked up from a strategy posted by wh. This example is for the 20 simple moving average. You can substitute any series based value for SMA(20) whether it be a standard NT indicator or a custom indicator. The TickSize will modify the scale for the instrument of the chart.
include the following in the variables section:
privatedouble radToDegrees = 180/Math.PI;
privateint sma20slope = 0;
I have just started using it so I can't comment on how well it works, but you could use a series for the slope result instead of an integer and plot it in a panel for testing. Please report back on your findings.
The following user says Thank You to Saroj for this post:
this is the common formula with two enhancements.
- the usage of two older Values (like a "mini" Moving Average) results in a more stable Slope-Calculation
- consider the Ticksize try to standardize price-skales with different amount.
The Snippet DID NOT WORK on Indikators, which oszillate between positiv and negativ Values.
The Ticksize Standardization is imprecise, because it gives us no adjustment if you switch between a 1Minute and 10 Minute Timeframe, and it also did not differenciate between price-data and indicator-data (i.e. from -1 to +1).