RedK Volume-Weighted Directional Efficiency Index (DXF)

RedK Volume-Weighted Directional Efficiency Index ( DXF ) is a momentum indicator - that builds on Kaufman's Efficiency Ratio (ER) concept.

DXF utilizes a restricted +100/-100 oscillator to represent the "quality" of a trend, and does a good job in detecting the possibility of an upcoming trend change (in both direction and quality), improving our ability to make decisions on trade entries and exits.

Here's a quick background on Kaufman's Efficiency Ratio (ER)
------------------------------------------------------------------------------- Copied from internet sources -----------------------------
Developed by Perry Kaufman and introduced in his book “New Trading Systems and Methods”, the Efficiency Ratio reflects relative market speed to volatility . There are cases, when it is used as a filter, which helps a trader to avoid ”choppy” markets or trading ranges and to identify smoother trends.

ER is the result of dividing the net change in price movement during n-periods by the sum of all bar-to-bar price changes during the same n-periods. In case the market is trending smoother, then the ratio will be higher. In case the ratio shows readings in proximity to zero, this implies that market movement is inefficient and ”choppy”.

If the Efficiency Ratio shows a reading of +100, this means that the trading instrument is in a bull trend and trending with perfect efficiency.
If the Efficiency Ratio shows a reading of -100, this means that the trading instrument is in a bear trend and trending with perfect efficiency.

It is impossible for any instrument to have a perfect Efficiency ratio, because any movement against the major trend during the examined period of time would cause the ratio to drop.

If the Efficiency Ratio shows a reading above +30 (common setting for the "Significant Level"), this is indicative of a quality bull trend. If the ratio shows a reading below -30, this is indicative of a quality bear trend.
------------------------------------------------------------------------------- End of Copy -------------------------------------------------------------------------------------------------------

Kaufman also used the ER as basis for his famous Kaufman Adaptive Moving Average ( KAMA ).

Read more on ER & Kama here

How is DXF different from other ER-based indicators?
- Let's get the easy part out of the way: DXF has a "volume-weighting" option ✔
This option is OFF by default (to avoid errors with instruments with no volume data)
- once this option is applied, it provides the benefit of combining the volume effect into the calculation - those who appreciate the effect of volume on price action will hopefully find this option valuable

- The calculation of ER and how it can be "best utilized":

Let's examine the ER concept a bit closer: as a (math) concept, the (original) Efficiency Ratio (ER) takes the positive change of the price of an instrument during a certain period, and divide it by the sum of (absolute) price moves that were observed during that same period.

So, in the trader's language, we will be saying "out of a total of $20 moves (up and down) that MSFT did in the past 10 days, MSFT only made a net change of $5 up during that period" - so the "10-day ER" for MSFT in that case is 5/20 = 25% -- then we continue to observe that ongoing "10-day ER" and if it increases, we can expect that MSFT is going to establish a strong move (trend) up --- right?

the magic word here is to "observe the ongoing ER" - many of the ER based indicators just use the ER as calculated by Kaufman's original method. IMHO, these are just "point-in-time readings" - if we hope to get real insights from the ER, we need to take an average of that reading - for our "time window" we're interested in - and only then we can identify trends and patterns in the ER value as it changes during that windowss- DXF does that - and that allows a trader to say "the (weighted) 5-day average of the 10-day ER for MSFT is increasing, and that why i expect an up-trend" -- makes sense ? both the "Lookback" used to calculate the ER, and the Length of observed "window" for the Average ER are adjustable in DXF settings

Other Uses and Settings :
- As a momentum indicator , DXF can predict an upcoming change of trend - cause that will reflect on the average ER value. There are few examples in the chart where the price move and ER trend *do not agree* - The trader can see these signs and take decisions accordingly

- DXF can help reveal best entries and exits: assume we are long-term bullish on MSFT , and we want to "buy the dip" - DXF can help reveal the time where price is recovering from extreme weakness - and that would be the ideal buy opportunities for us - exampled marked on the chart

- the Stepping & Smoothing options enable better visualization of the DXF plot. the "raw" DXF is still shown as a silver line.

- The "Significant Levels" option is available and is set to -20/+20 by default .. also adjustable in indicator settings.

- Please use DXF in combination with other trend and volume indicators, and with thorough chart / price action analysis and not in isolation to ensure you get proper signal confirmation for trades. In the chart above, you can see DXF combined with a moving average that can act as a filter and to confirm the price moves.

As usual, feedback & comments are welcome - if you find this work useful in your trading arsenal, please share a comment - i would be more than happy to learn about that. Good luck!
Release Notes: - update code comments
Skript med en öppen källkod

I sann TradingView-anda har författaren till detta skript publicerat det som öppen källkod, så att handlare kan förstå och verifiera det. Skål för författaren! Du kan använda den gratis men återanvändning av den här koden i en publikation regleras av våra Ordningsregler. Du kan göra den till favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?


350 coins
RedKTrader VonnyFX
@VonnyFX, thank you - glad you found this valuable to your trading (i hope :))
100 coins
This looks really nice, thanks!
One tweak I've made to the stepping feature is having it only applied when the dataseries is within the step range. Could be a useful option.
dxf = step > 0 and (dxf_s < step and dxf_s > -step) ? round(dxf_s / step) * step : dxf_s
+1 Svara
RedKTrader AtomOfScent
@AtomOfScent, thanks for your interest

you suggestion changes the way stepping works from what i meant it to do - but as long as you get what "you" want to see, then absolutely, please feel free to customize as much as you need.

good luck!
+1 Svara
AtomOfScent RedKTrader
@RedKTrader, my understanding of stepping is that it's meant to reduce false signals near 0 (assuming crossing above/below are considered trend changes) and the rest of the time it can be desirable for the data to remain unstepped. But I guess there's more than one way to use it...
+1 Svara
RedKTrader AtomOfScent
@AtomOfScent, i use stepping to show the value in ranges - or bands - to further simplify reading the output. since a value of 13 or 9 or 57 wouldn't really mean anything specific, using a stepping of, for example, 20, will make the 100 range split into 5 bands - that can be read / interpreted as weak, medium, strong, very strong, extreme.. (that's an example) - and also make the values easier to compare with prior values. the user can choose the level of "granularity" of that stepping, or no stepping at all .. also note that i set precision to 0, again because the fraction in the value means nothing. i do my best to try to minimize "noise" in indicators as much as possible with these fine adjustment to increase their usability.

the significant level (default here is 20) should takes care of identifying "significant / actionable" value , below which a trade should be avoided.

but again, that's how i would like to use stepping :) - not necessarily every one else :) - please feel free to customize to your preference..
+2 Svara
AtomOfScent RedKTrader
@RedKTrader, that makes sense. Thanks for the explication. :)
+1 Svara
does it repaint???
RedKTrader yourexdante
@yourexdante, DXF will update in real time for current bar - no changes for closed bars.