RedK Directional Efficiency Index
"RedK Volume-Weighted Directional Efficiency Index (DXF)" by RedKTrader, MPL-2.0. Ported to FloScript by FloSignals; modifications under MPL-2.0. Original: RedK Volume-Weighted Directional Efficiency Index (DXF) (v3.0), read 2026-10-12T16:17:47.506Z; source language v5.
Licence: Mozilla Public License 2.0 (MPL-2.0) — full text. The source is published with it, modifications included, under the same licence.
RedK Volume-Weighted Directional Efficiency Index (DXF) by RedKTrader, ported from Pine v5. Pane indicator with 2 plots, 3 fills, 5 levels and 7 inputs.
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © RedKTrader
// ------------------------------------------------------------------------------------------------
// Original author: RedKTrader
// Original title: RedK Volume-Weighted Directional Efficiency Index (DXF)
// Licence: MPL-2.0 (the header above is the original notice, kept verbatim)
// Pine version: 5
// Fetched: 2026-10-12
// Ported to FloScript by FloSignals; modifications under MPL-2.0.
// Converter: @flosignals/floscript 0.1.0, strict mode, score 100/100
// ------------------------------------------------------------------------------------------------
//@floscript=1
//@version=5
indicator('RedK Directional Efficiency Index', shorttitle='DXF v2.0', precision=0, timeframe='', timeframe_gaps=false)
//======================================================================================================
// Calculate (weighted) Average Efficiency Ratio. Apply volume weighting if selected
// then scale result to -100/+100
// Efficiency Ratio = sum of "positive" price change / sum of "absolute price change" for given length
f_avgdxf(_price, _length, _vol, _avg) =>
mf = ta.change(_price) * _vol
SumAbsChange = math.sum(math.abs(mf), _length)
SumUpChange = math.sum(math.max(mf, 0), _length)
o_dxf = SumUpChange / SumAbsChange * 200 - 100
o_avgdxf = ta.wma(o_dxf, _avg)
//=======================================================================================================
// Inputs
price = input(close, 'Price')
lookbk = input.int(10, 'DXF Lookback', minval=1)
length = input.int(5, 'Avg Length', minval=1)
smth = input.int(3, 'Smooth', minval=1)
step = input.int(20, 'Step [0 = No Step]', minval=0, step=5)
s_level = input(20, 'Significant Trend Level')
vol_w = input(false, 'Volume Weighted?')
// Calclations
v = vol_w ? volume : 1 //Apply volume-weighting if selected
dxf_raw = f_avgdxf(price, lookbk, v, length)
dxf_s = ta.wma(dxf_raw, smth) //Apply smoothing & stepping if selected
dxf = step > 0 ? math.round(dxf_s / step) * step : dxf_s
// ==============================================================================================
// Colors, Plots & Fills
c_up = color.new(#33ff00, 0)
c_dn = color.new(#ff1111, 0)
up = dxf >= 0
c_zeroline = color.new(color.yellow, 70)
l_zero = hline(0, color=c_zeroline, linestyle=hline.style_solid, editable=false)
l_splus = hline(s_level, color=color.green, linestyle=hline.style_dotted, editable=false)
l_sminus = hline(-s_level, color=color.red, linestyle=hline.style_dotted, editable=false)
l_100plus = hline(100, color=color.new(color.green, 90), linestyle=hline.style_dotted, editable=false)
l_100minus = hline(-100, color=color.new(color.red, 90), linestyle=hline.style_dotted, editable=false)
fill(l_splus, l_sminus, color=color.new(color.orange, 70), title="Neutral Zone")
fill(l_splus, l_100plus, color=color.new(c_up, 80), title="Bull Zone")
fill(l_sminus, l_100minus, color=color.new(c_dn, 80), title="Bear Zone")
plot(dxf_raw, 'DXF Raw', color=color.new(color.silver, 0), linewidth=1)
plot(dxf, 'DXF', color=up ? c_up : c_dn, linewidth=3)
This file is under the Mozilla Public License 2.0; it is a port of the original by RedKTrader, with the original licence header kept and the changes made for FloScript noted in the file.
- v2
Library refresh 2026-10-14
- v1
Library refresh 2026-10-12
Disclaimer. Scripts are written and published by members, or ported by FloSignals from open-source originals, and are their authors' own work and opinion. FloSignals does not review them for correctness and nothing in a script is financial advice or a recommendation to buy or sell anything — read the Risk Disclaimer. Posting here is under the Community Rules; a script that is not the poster's to post can be reported as the Copyright & Takedowns page says.

Comments (0)
No comments yet. Members can leave one.