I need to come back to the concept of slope. If you have a 10 tick move on a 5 min chart and you consider that steep, what would you consider steep on a 60 min chart? Certainly not a 10 tick move. The theoretical answer tells you that the equivalent would be close to a 10 * sqrt(12) = 35 tick move. The practical approach is to compare that move to the average bar size of the last xxx bars. The average true range just stands for average bar size.
Also it is important to understand that the slope of the moving average is a proxy for momentum. If you calculate the slope of a SMA it is the current value of the SMA minus the prior value, divided by a scale factor. The difference current value - prior value of a N-period SMA is identical with the N-period momentum divided by N. Slope therefore means N-period momentum divided by (N * scale factor).
The neutral threshold allows you to define what you consider flat. If you move that threshold up to 1000 the whole world will be flat. If you move it to zero, no slope is small enough to be considered flat. By selecting an appropriate number you can define a range for what is considered "weak momentum". This is experimental, you could for example set that value to 100.
The yellow areas cannot be described as a squeeze. Zero momentum can be created by too large moves that cancel out. A squeeze means that price has been sitting in a narrow range for some time, where narrow range is defined in terms of barsize.
The following 3 users say Thank You to Fat Tails for this post:
The squeeze compares N-bar volatility to intrabar volatility. It detects a situation where N-bar volatility is unusually low compared to intrabar volatility.
If you color code a Bollinger Band depending on the bandwidth (which is just the standard deviation), then you look at absolute levels of volatility, without comparing them to intra-bar volatility.
Low levels of absolute volatility mostly conincide with low levels of volatility relative to intra-bar volatility. A Bollinger Band indicator color coded on bandwidth would be something similar as the squeeze. If you compare the bandwidth to barsize, that is exactly the formula for the squeeze.
The following 4 users say Thank You to Fat Tails for this post:
Thank you again for your continuous contribution .... I would very much like to have your detailed "Slope Calculation" description .... As i have no programming knowledge, it is not possible to understand and interpret the code .... Please also make a reference to "neutral zone" ....
Waiting for your kind and detailed answer .... Thank you in advance.....
Slope is a geometrical concept which was used as a proxy for momentum. The geometrical slope depends on the vertical and horizontal scales used. The original idea was to look at momentum and to divide it by the number of bars (rise over run). If you use the slope of a moving average, you just need to compare the values of two consecutive bars, as the lookback period of the moving average is already taken into account.
Vertical scale value (not normalized): Price difference between the current bar's and the prior bar's value
Vertical scale value (normalized): Price difference between the current bar's and the prior bar's value divided by average bar true size over a longer lookback period
Horizontal scale value : 1 bar
A normalized formula for the slope would therefore be
slope = (current value of MA - prior value of MA) / average true range
I have seen concepts that use the ticksize instead of the average true range, but this is not very helpful. If you use ticksize, YM will always show steeper moves than ES, because its relative TickSize is smaller.
The indicator uses a variation of that definition of slope. Instead of the difference between current value and prior value of the MA it uses the difference between the current value and the average value of the two preceding bars. This also means that a correctional factor of 1.5 must be applied.
slope = (MA - 0.5* MA - 0.5* MA )/(average true range * 1.5)
which is a smoother version of slope. You can think of this as an artificial slope which applies to all instruments and timeframes.
The neutral threshold just measures that slope against a percentage. A value of 30 means 3%. This means that all slope value between -3% and + 3% are considered as insignificant (flat), which translates into a yellow color.
The following 3 users say Thank You to Fat Tails for this post:
Thank you for your detailed description ..... I am trying to find a solution into "calculating slope" ... the obtained results are not satisfactory ..... I will try your logic and calculations ....... I will let you know ....
Thank you again for all ....
The following 2 users say Thank You to dimitri for this post:
Thank you @Fat Tails for those great descriptions. I have a late start today and will enthusiastically focus on those posts after the coffee kicks in. On the most basic level I was looking for an improved typical squeeze type indicator with less lag that could be placed on the price field as I already have a good tenant in the sub-graph. Two sub graphs and IMO you start to queer up price action, which of course is and should always be king. I do enjoy the bpfsqueeze and the view I get from the Gaussian filter drawn histogram. I'm still trying to figure out what draws the signal/zero line though.
Be well Fat Tails and trade well.
The following 2 users say Thank You to wldman for this post:
@dimitri: My indicator is open source, you can simply copy the code and analyze it.
If you look at my definition of slope I take the vertical distance of two consecutive points of the moving average. This distance represents something like the average per bar momentum over the lookback period. I then divide that value by the average true range. This is the simple version.
The indicator basically does the same thing, but uses two prior points P1 and P0 to calculate the slope. This gets you a slightly smoother variation of slope.
The chart below shows a delta of 0.05 against an average true range of 0.134. Division gets me a slope of 37%. If the absolute amount of that slope is smaller than 3%, the moving average will be displayed as yellow if the threshold is set to 30 ‰ (which is 3%).
Please register to view the post attachment(s), image(s), or screenshot(s) - it's simple and free.
The following 2 users say Thank You to Fat Tails for this post:
don't mean to confuse things, and i follow the slope discussion with interest.. very interesting thought to use ATR to arrive at a "relative" slope that can be used between different instruments and still provide a usable reading..
here's my mathematical view - as i did give this a shot few weeks back before i saw the discusion on futures.io (formerly BMT) - hoping this approach may give some thoughts to fellow scripters. will try to avoid complex pure math stuff,
- we are not living in a linear world when looking at a chart of a future or stock price as it goes up & down, but rather in a relative/log-based .. where i'm more interested in a 1% decreasse or increase rather than the $$ value. while the absolute dollar value of that 1% will change depending on what the current price range is, the 1% itself remains the same. for me that means slope "rise" need to be based on percentatges change and not absolute $ value change..
calculating price change relative to ATR(length) is a very practical approach to work around things & convert rise to a relative/percentage, my worry is, ATR(length) is not a constant and will slightly change with volatility, but maybe then, i may want that factor being built into the result. just need to be aware of it.
- the MA is not a line, but a curve.. so in slope calc we need to use the "slope of a tangent of a curve" version and not the "line slope" version..
considering these 2 points in calculating slope produces an angle, and regardless of scale of chart, underlying price range, or change of ATR(length) due to price fluctuating during certain periods, the angle of slope will continue to be a usable metric.. then you can say, between +15 and -15 i'm not interested as it shows a weak move ..
i can share the script for ToS .. reason i don't use it, it was almost the same curve as the momentum study i use.. so went back to Momentum.
hope this helps add another perspective,
Last edited by RedK; September 15th, 2012 at 09:29 AM.
The following 2 users say Thank You to RedK for this post:
So @Fat Tails maybe square scaled charts would create a more perfect visual on this?
Thanks so much for the feature and for the explanation here. The preset setting of 30 represents 3% slope or something just less than 1:3 where there is 1 unit of "rise" to every 3 units of "run"?
I'm thinking that a squeeze like indicator could be created measuring the relationship between the slopes of two lines, in this case the bollinger and the keltner. Those are not totally non colinear, but I wonder if the same relationship could be viewed with value between two non colinears.
Hate to be so nerdy, but I do sit and ponder this type of thing all the time.
The following user says Thank You to wldman for this post: