OPEN-SOURCE SCRIPT

RedK Volume-Weighted Directional Efficiency Index (DXF)

Cập nhật
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!
Phát hành các Ghi chú
- update code comments
Phát hành các Ghi chú
DXF v2.0 introduces couple of improvements:
- Upgrade code to Pine v5
- Enabled the ability to use DXF in a different timeframe than the chart
- visual enhancement using fills for neutral, bull and bear zones (can be disabled in indicator settings)

The below chart shows an example of DXF v2.0 using a 1hr TF on a 10min price chart (and against DXF v1) - with the ability to see when DXF on the higher timeframe is green (we should favor long positions and avoid going short) versus when it's in the red (where we should favor short positions and avoid going long) - and when DXF is in retracement from one zone to the other. This view is now possible with DXF v2.0

ảnh chụp nhanh

Centered OscillatorsdirectionalefficiencyefficiencyratioKaufman's Efficiency RatioredkTrend AnalysisVolatilityvolumeweighted

Mã nguồn mở

Theo tinh thần TradingView thực sự, tác giả của tập lệnh này đã xuất bản dưới dạng nguồn mở để các nhà giao dịch có thể hiểu và xác minh. Chúc mừng tác giả! Bạn có thể sử dụng miễn phí. Tuy nhiên, bạn cần sử dụng lại mã này theo Quy tắc nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Thông báo miễn trừ trách nhiệm