Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
relative smoothness over range
Collapse
X
-
relative smoothness over range
I would like to know the relative smoothness of a plot over a some range. What I have been doing is noting the difference in slopes (pseudo angle) of adjacent segments over the range. If the maximum pangle is less than my thresh then the range is smooth enough. The problem is when at least one segment in the range has a different sign than the rest. With trig I would just roll around the circle 180 degrees. These are not real angles. Any ideas?Tags: None
-
Hello bernie_c,
If you are looking for a formula to find this I will not be able to assist but this thread will remain open for the community to offer help.
If you are trying to find slope, use the Slope() method.
http://www.ninjatrader.com/support/h.../nt7/slope.htm
If you would like a link to a list of professional NinjaScript Consultants who can create this formula for you, please let me know.Chelsea B.NinjaTrader Customer Service
-
Originally posted by bernie_c View PostI would like to know the relative smoothness of a plot over a some range. What I have been doing is noting the difference in slopes (pseudo angle) of adjacent segments over the range. If the maximum pangle is less than my thresh then the range is smooth enough. The problem is when at least one segment in the range has a different sign than the rest. With trig I would just roll around the circle 180 degrees. These are not real angles. Any ideas?
Comment
-
I agree koganam. I don't really care about angles. I just use the word angle for lack of a better one. I realize the relationship of one slope to another is not a real angle, at least not in the classical sense. That is why I am a little stumped. Well, that and I am up way too late
What exactly do you mean by normalize?
Comment
-
Normalization is a mathematical process. This is done in three steps.
(1) First you need a vectorspace (a set of data points) and the define a norm (a mathematical formula that allows to measure the distance).
(2) In a second step you apply that norm to your vectorspace (calculate a distance for those data points).
(3) You divide momentum by the result of the calculation under step 2.
Mathematical formulae that can be used as a norm are the standard deviation and the average range or average true range. Both standard deviation and average range / average true range can be calculated directly from your data points.
Example:
Let us us the standard deviation for nomalizing an oscillator with a bad behaviour. Bad behavior means that the indicator is not normalized and does not pass the c-test by trader Willliam Eckhardt. For example
-> RSI, Stochastics and TSI are well behaved (already normalized) and pass the c-test
-> Momentum, ROC or MACD are not well behaved and require normalization
For the sake of simplicity, I will show one possible normalization process for the momentum indicator.
-> calculate the standard deviation for the last N (for example N= 100) data points
-> then calculate the difference from current close and mean (=SMA) of the last N data points and divide it by the standard deviation
The result is something well known and called the Z-Score of momentum. The chart below shows momentum and the normalized momentum (normalized over the last 100 bars).Last edited by Harry; 03-01-2015, 02:24 AM.
Comment
-
More details on normalized slopes can be found here:
"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. Ticks are not suited to normalize momentum or slope But ticks or tick size are not at all suited, because the ticks do not reflect volatility. Forget the ticks, you cannot use them for normalization. And best forget the concept of slope, angles and remember that they were just used to visualize …
The BollingerUniversal indicator here
The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies
allows to color midband and channel according to slope. This indicator does not use the standard deviation for normalizing the slope, but it uses the average true range. As long as the slope of the bands is within a range that is expressed as a multiple of the average true range, it is considered flat and plots yellow. Only when that range is exceeded, the indicator lines will plot green (upsloping) or red (downsloping).
It would have been possible to build the same indicator by using the standard deviation as a norm.
Comment
-
Originally posted by bernie_c View PostI would like to know the relative smoothness of a plot over a some range. What I have been doing is noting the difference in slopes (pseudo angle) of adjacent segments over the range. If the maximum pangle is less than my thresh then the range is smooth enough. The problem is when at least one segment in the range has a different sign than the rest. With trig I would just roll around the circle 180 degrees. These are not real angles. Any ideas?
Very briefly if you're trying to analyze smoothness over an interval.
In calculus, you'll remember that with polynomials (f(x) = x^3 + Ax^2+Bx+C, etc.) when you take differences (f(x+a) -f(x)), they become less chaotic and eventually the diffs of the diffs, etc., become zero: this is exactly what the differentials do.
So my idea, which may lead nowhere at all, is to set up a loop for the first-order differences, then repeat the process a few times. The more 'ordered' the n-th diffs are (or the smaller the weighted average difference preferably) may be evidence of the smoothness of the original price data over that interval.
Just an idea!
Comment
-
Originally posted by bernie_c View PostI agree koganam. I don't really care about angles. I just use the word angle for lack of a better one. I realize the relationship of one slope to another is not a real angle, at least not in the classical sense. That is why I am a little stumped. Well, that and I am up way too late
What exactly do you mean by normalize?
A lot of folks like to think of a slope as representative of an angle. This is only really true if the slope itself is dimensionless, because in that case, the two parts that make the slope, the rise and the run are being measured in the same units, (usually on the same linear scale). Remember that an angle is a representation of distance/distance.
Rise/run on a chart is money/time, which is not a dimensionless quantity. As an example, take a rise of $2 over 10 bars. The slope would be calculated as 0.2$/bar. However, does this represent the same information on a $1000 index as it does on a $10 stock? Evidently not. So we have our measure being inconsistent as an indicator.
The solution is to measure this putative slope as a multiple of some measure of the equity itself, and how fast it moves. The process of doing so is called normalizing the resulting slope, as it now is a measure of the absolute slope as a proportion of the "normal movement" for each equity. Such measures include such things as Harry identifies: average range, average true range and standard deviation being the most usual ones.
On a philosophical note: What we traders call momentum, should properly be called speed, as it represents only two quantities, movement/time: there is no representation of mass. Calling it momentum tacitly assumes a mass of 1. If called speed, then momentum would properly be a measure of a portfolio representation, which would then include the number of shares as representing the mass. But, never mind, that is just a mathematical purist talking. The mass of traders think of it as momentum, so so shall we.Last edited by koganam; 03-01-2015, 11:46 AM.
Comment
-
Thanks for all your detailed responses. I learn a lot listening to you folks. I apologise for starting this bit of white noise. My original intuition was correct.
All I need to know is how smooth two adjacent segments of a plot are. Subtracting one slope from the other gives a relative indicator of straightness. 0 = straight ( both segs have same slope). The larger the number the less straight. This number is not an angle, but it can be used to compare relative straightness of segment pairs.
I ended up using Print() to print out a bunch of seg slopes. I then copied them into a spreadsheet and proved the concept. Worked just fine.
Thanks again.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,403 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
||
Started by Shai Samuel, 07-02-2022, 02:46 PM
|
4 responses
94 views
0 likes
|
Last Post
by Bidder
Today, 12:11 AM
|
||
Started by DJ888, Yesterday, 10:57 PM
|
0 responses
6 views
0 likes
|
Last Post
by DJ888
Yesterday, 10:57 PM
|
||
Started by MacDad, 02-25-2024, 11:48 PM
|
7 responses
158 views
0 likes
|
Last Post Yesterday, 10:23 PM | ||
Started by Belfortbucks, Yesterday, 09:29 PM
|
0 responses
8 views
0 likes
|
Last Post
by Belfortbucks
Yesterday, 09:29 PM
|
Comment