Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
Broker: IQFeed, Ninja, Own C# with API to Trade King and IB
Trading: stocks
Posts: 39 since Jul 2011
Thanks Given: 22
Thanks Received: 25
this thread is probably dead but maybe someone needs the answer still. First, why should you be interested in slope... Well, it's an immediate response to change and allows for a visual view if using lines, boxes, rectangles... etc to see what's happening. It is easier to view a program and your logic visually...
I am using int names as example to help reason the code
int starting_bar = 4... Bars back
int ending_bar = 0... Now
int smaperiod = 4
if(degree < -45)
....going down
if (degree < -70)
.... going down fast
if (degree > 45)
.... going up
if (degree > 70)
.....going up fast
Let's say you are using pivot points... and you want to tell the last time the price was in the current range... is there a chance of a reversal....
so you will need to store the CurrentBar for the last time it was in the area... I use List<int> for that. Each time the tick is in the area you can just add it to a list.
Then when the last price is in the area... you can draw a line from the last bar in the pivot area to the new price in the current pivot area.. This will visually help you to look at what's going on... And you can check the degree for higher lower... Remember... pivot points change over time... I am enclosing an example of a modified murrymath that I show a reflection of change. I use angles from the old murraymath and the new...
Can you help answer these questions from other members on NexusFi?
So in this equation , the "Slope" function returns the ratio y/x of the triangle formed by the SMA of the startingbar to endingbar. Then that result is put into the System.Math.Atan (inverse tan) function which returns the angle in radians. Then that result is multiplied by the 180/pi conversion factor to change from radians to degrees. Is that correct? Does that "Slope" function come with NT7? Thanks.
Perry's continuation method has the indicator MASlopeMulti which shows the angles; but it's all in .dll ..
Nice pic. Makes it look like trading in 3D
I will try to find it and maybe copy it into a WIKI as @Fat Tails has a good perspective on this calculation. I think the moral of his story is to "normalize" the slope rather than make it visually correct. That way a 1 min and a 5 min chart for the same rise in time will be about equal.
Rise/Run ~= (Price change)/(Delta time over change)
He recently put this together for me and I feel bad I can't put my finger on it right now.
"Slope" does not exist on scalable charts. The concept "Slope" refers to print outs and was used 50 years ago when charts were printed and neither the time scale nor the price scale were ever changed.
Broker: IQFeed, Ninja, Own C# with API to Trade King and IB
Trading: stocks
Posts: 39 since Jul 2011
Thanks Given: 22
Thanks Received: 25
I didn't think I was suggesting that you can take the slope in a 3 minute chart and compare a slope that was in a 10 range chart... Yes they are different and it would be hopeless to look at the two... If I gave that impression... I am sorry... But slopes and visual lines are very helpful in looking at how to code or how your code is behaving...
But a chart with a High-Low range of 10 points, and a chart with a High-Low range of 20 points, will have a different scale and different slope angle, even though it is identical instrument, time frame, etc.
I will let @Fat Tails answer, he has covered this many times and does a much better job at it than me.
That is I think the point @Fat Tails makes. How I digest his suggestion is that "Slope" be calculated as if it is plotted on the same Full Chart rather than zoomed in. I think there is a visual aspect of a zoomed in section of a chart (looks like 45degrees to me) but as you zoom out (by changing just the X or just the Y) the angle will change. Certainly if you maintain the aspect ratio it isn't a big deal.
First and foremost, we probably should disclose "Angle/Slope" calculations within our indicators so the user knows if they can apply that "angle" to other charts they are looking at or if it is almost simply a "Local Reference".
Not sure this makes sense as I am still struggling a bit myself, but this is how I have internalized the problem/concern. (Prior to Fat Tails discussion, I didn't think much of it but you look at Perry's system where he looks at the angle of multiple time-frames. This is where I think it is critical, single timeframe and instrument, not so much)
Slope is a geometrical concept that was useful, when people had their daily charts printed out with ever the same time scale on the x-axis and the same price scale on the y-axis. The geometrical concept of slope was simply used to describe momentum. A steep slope meant high momentum, a horizontal line meant no momentum.
With charting software that distorts the x-axis, at least for non time based-charts in equidistant mode and that autoscales the y-axis, the geometrical concept of slope makes no sense. It does no more represent momentum, but is just an optical illusion.
If you want to measure momentum, you can create an indicator that calculates the slope, as if the x-axis was teim-based and non-compressible and as if the y-Axis would use a fixed scale. This exercise will yield you an artificial angle, which can be used as a proxy for momentum, but is different from the angle which you will see on your chart. To calculate the artificial angle you need to compare the directional price move to intrabar volatility, by dividing the n-bar momentum by n times the average true range or standard deviation. You can then use the result to get your much-loved angles.
I do not use angles. In my opionion it is simply nonsense to use angles on charts with a non-linear, compressible time axis and/or an autoscaling y-axis. Better use momentum or the rate of change.