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)
Is there any code around for calculating the slope of an MA that would be designed to only run in Market Analyzer?
I don't want to do a Plot override if possible (for future conversion to NT 8, I imagine this is going to be messy) and also want to keep the code very simple.
So, it would be better, if possible that it didn't need chart code at all.
Also, a lot of the slope code I've seen tries to be a Swiss Army Knife with tons of options and tons of types of MA.
I am going to have background processes that use this data, but I don't need to see it.
Charting programs are scalable. The absolute value of the slope as no meaning. You need to move away from geometrical concepts.
The simple slope value or line tangent can be calculated as the rise over run with the run being 1.
It is simply the change of the indicator value.
As I have tried to explain, you should normalize this result by dividing through the average true range.
If you do not normalize, you will have a different scale for each instrument, each bar type and each time frame.
Rescaling the slope
To understand normalization, please have a look at the RSI and the MACD.
The RSI is a normalized indicator. Whatever instrument you selecrt, whatever chart you apply it to, whatever bar period you select, the overbought line is always located at 70. If you add a MACD to your chart, the values you will read depend on instrument, bar type and bar period and have no meaning. What would be your conclusion, if the MACD value 0.278, what iwould be your conclusion if the market analyzer display a MACD of 5.16?
Slope as well only makes sense, if you read it against a normalized scale. Temperature also requires a scale to measure it. Without a scale any information bcomes is useless. Therefore you need to rescale the slope by normalizing it. After normalizing you can compare different values obtained for the slope.
I only use range bars on all instruments... 4 Range and 10 Range... never anything else....
I never use time based bars...second, minute, hour, day... none of those
I believe I understand what you say would make a difference on time based bars....but am not sure it would be the same on a Range bars...because there is no time basis at all on the X axis, and each bar has the same length.
I will have to spend some time with your suggestion so I can visualize it and see if it produces the results I need. At this moment I don't know, without testing it.
I'm outside my area of expertise...but it seems to me that a "simple slope (rise / run)" is not the same as "line tangent"
"Simple slope" is geometry, and "line tangent" is calculus?
I believe they use the terminology "line tangent" because it is the slope of the tangent line at an exact point on the curve, not the simple slope between two points on the curve.
From what I understand "line tangent" is the slope at any moment in time on the curve...on a dynamic curve (MA/SMA) the "line tangent" changes as the curve in each moment on the curve....so it is "slope of that instant" (instantaneous slope) and not a simple slope from the beginning of the curve to the end of the curve or rise/run.
Marthematically, the concept of the line tangent can only be applied to a continuous function. However, any price time graph is not continuous but discrete. Therefore, it is impossible to calculate a line tangent.
With discrete values, the concept of the tangent is replaced with the slope, where
slope = price difference / time interval = rise / run = rise over run
The slope that comes closes to the tangent, is the slope calculated from the smallest available time interval, which is made up from two adjacent bars.
This is exactly, what I have suggested to use. However, in a second step you should divide that slope by the average true range
normalized slope = rise over run / average true range
which is what you may display on your market analyzer.