NexusFi: Find Your Edge


Home Menu

 



Categories Help    






 
True Slope Indicator V1 5 *
THERE IS A NEW VERSION OF THIS INDICATOR. FIND IT AT:
https://nexusfi.com/download/ninjatrader-7/indicators/1922-download.html?view

At various times, I have wanted an indicator that showed the slope of a line between two price points on a chart. I looked here on the forum for one and found a number of people discussing it, generally attempting to measure the slope of a line they'd drawn on the chart, and realizing that, if the chart is resized in any way, the slope is changed, blowing its usability.

I finally looked at the question independent of the chart. Treating the problem as that of measuring the leftmost angle of a right triangle, with the hypotenuse formed by the price at the starting point and the price at the end point and the right angle at the lower right, I finally found a usage for the trigonometry classes I'd had.

If you know the length of two sides of a right triangle, you can calculate the angles using the inversions of the sine, cosine and tangent functions, the arcsin, the arccos and the arctangent.

Taking the difference in price between the starting bar and the ending bar, converted to ticks, as the height of the side opposite the angle and the number of bars as the length of the side parallel to the bottom of the chart, the leftmost angle can be calculated and it will stay the same regardless how the chart is resized. This gives the 'real' angle, or slope, of a line drawn from the price on the starting bar to a price on the ending bar. Fortunately, the C# programming language contains the arctan function, Atan(), so it was possible to build the math without my brain exploding.

I wrote a NinjaTrader indicator that allows you to choose whether to start on Open, Close, High, Median or Low, to choose whether to end on Open, Close, High, Median or Low and the period, or number of bars, you want to measure. I have uploaded the .cs file, zipped. Just import it, as usual. All the math is contained within the indicator.

No line is drawn on the chart (since it calculates for every bar, you'd potentially have a bazillion confusing lines). Instead a new panel is created with the angle at each bar plotted, between +90 and -90, which would be the angle if you measured price change on one bar.

The usability of this indicator is not as immediately obvious as I expected it to be. However, you can see that, where the plot makes a kind of 'plateau' or trough, price is continuing steeply up or down. With a long period, areas that are usually called 'chop' can be seen, as the angle maintains a value closer to zero.

This is not a lagging indicator, regardless how long the period is. Price movement on the current bar is immediately reflected in the angle. Relatively short periods can be used, for example, in automated trading to help guard against sudden unfavorable price spikes, an intra-day nemesis.

I have not tested moving averages of the angle, but those may also be useful, though will add a lag, of course.
(11/25/15) I have found myself using a Linear Regression Channel of the angle indicator and comparing to an LRC of price.)

I may also make an indicator that averages high-to-high, low-to-low, median-to-median and high-to-low angles in an attempt to emulate what the human brain does when we look at a chart. We see all this detailed activity, but the brain sort of fuzzes the image allowing us to immediately see, price going up, price going down, price going nowhere. Seeing the forest, rather than the trees.

If it seems to do the trick, I will post that, as well.
(11/25/15) After further exploration, I realized that the Linear Regression Channel indicator that comes with NinjaTrader does this already, and better than I could.

I hope those of you looking for an angle/slope indicator will find this of some use.

(Double-checked math. It is correct and you can use it with confidence. Understand that the 2 period minimum actually goes BACK 2 bars, so this version minimally measures 3 bars, including bar 0. 11/19/15)


Category NinjaTrader 7 Indicators 
 
Suggest other entries I might like
Details: True Slope Indicator V1
Category: NinjaTrader 7 Indicators 


November 15th, 2015
Size: 2.53 KB
Downloaded: 323 times
Comments/ratings
5 * stef November 16th, 2015 06:37 AM
Thanks !
5 * tcwairoa November 16th, 2015 06:49 AM
Wow, this is awesome work, thank you.
4 * JoyNinjaTrader March 25th, 2016 08:02 PM
Hi David,
Thanks this could be useful indicator.
However, after installing I am not able to find it in the indicator's list!
Yes, it is installing properly, but it is not visible in the indicator list
or in the list of indicators in the “Edit NinjaScript” panel
… what am I doing wrong…
please advise. Thanks

 
Sort by

 




© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top