Modjoy-Ehlers Loops [BigBeluga]
Modjoy-Ehlers Loops: Unveiling the Power of Adaptive Trading Strategies |
|
Introduction to Modjoy-Ehlers Loops, a cutting-edge trading approach that leverages the concept of adaptive loops to optimize trading performance. |
What are Modjoy-Ehlers Loops?
Modjoy-Ehlers Loops, also known as BigBeluga, is a novel trading strategy that combines the principles of John Ehlers' work on adaptive filters and the Modjoy indicator. This innovative approach aims to improve trading accuracy by incorporating adaptive loops that dynamically respond to changing market conditions.
Core Logic of Modjoy-Ehlers Loops
The core logic of Modjoy-Ehlers Loops revolves around the concept of adaptive filtering, which enables the strategy to adjust its parameters in real-time to optimize trading performance. The Ehlers' adaptive filter is used to smooth out noise and extract the underlying trend, while the Modjoy indicator provides a momentum-based signal to confirm trade entries and exits.
Key Components of Modjoy-Ehlers Loops
- Ehlers' Adaptive Filter: A proprietary filter designed to reduce noise and extract the underlying trend in price data.
- Modjoy Indicator: A momentum-based indicator that provides a confirmation signal for trade entries and exits.
- Adaptive Loops: A feedback mechanism that adjusts the strategy's parameters in real-time to optimize trading performance.
Trading Strategy
The Modjoy-Ehlers Loops trading strategy is designed to capitalize on trending markets while minimizing losses during times of high volatility. The strategy involves the following key steps:
Step 1: Trend Identification
Use the Ehlers' adaptive filter to identify the underlying trend in the market. This involves applying the filter to the price data and analyzing the resulting trend line.
Step 2: Momentum Confirmation
Use the Modjoy indicator to confirm the trend identified in Step 1. This involves analyzing the momentum signal provided by the Modjoy indicator and ensuring it aligns with the trend.
Step 3: Adaptive Loop Adjustment
Adjust the strategy's parameters using the adaptive loop mechanism. This involves feedback from the trading performance and adjusting the parameters to optimize future trades.
Step 4: Trade Execution
Execute trades based on the confirmed trend and momentum signal. This involves entering long or short positions depending on the trend and momentum signals.
Advantages of Modjoy-Ehlers Loops
The Modjoy-Ehlers Loops trading strategy offers several advantages, including:
- Adaptive Trading: The strategy adapts to changing market conditions, ensuring optimal trading performance.
- Reduced Noise: The Ehlers' adaptive filter reduces noise in the price data, resulting in a more accurate trend identification.
- Momentum Confirmation: The Modjoy indicator provides a momentum-based confirmation signal, reducing false trade entries.
Conclusion
In conclusion, the Modjoy-Ehlers Loops trading strategy is a powerful approach that leverages adaptive loops to optimize trading performance. By combining the principles of John Ehlers' work on adaptive filters and the Modjoy indicator, this strategy provides a unique solution for traders seeking to capitalize on trending markets while minimizing losses during times of high volatility. As with any trading strategy, it is essential to thoroughly backtest and evaluate the performance of Modjoy-Ehlers Loops before implementing it in live trading scenarios.
Modjoy Exclusive Source Code:
//@version=5
indicator("Modjoy-Ehlers Loops [BigBeluga]", overlay=false, max_lines_count = 500, max_labels_count = 500)
// =====================================================================================================================}
// INPUTS
// ====================================================================================================================={
int LPPeriod = input(10, title="Low Pass Period", group = "Ehlers Loops")
int HPPeriod = input(125, title="High Pass Period", group = "Ehlers Loops")
color m_col = chart.fg_color
color s_col = color.new(m_col, 70)
int Offset = -100
bool on_1 = input.bool(true, "", inline = "1", group = "Symbols")
bool on_2 = input.bool(true, "", inline = "2", group = "Symbols")
bool on_3 = input.bool(true, "", inline = "3", group = "Symbols")
bool on_4 = input.bool(true, "", inline = "4", group = "Symbols")
bool on_5 = input.bool(true, "", inline = "5", group = "Symbols")
string sym1 = input.symbol("BTCUSD", inline = "1", group = "Symbols")
string sym2 = input.symbol("ETHUSD", inline = "2", group = "Symbols")
string sym3 = input.symbol("SOLUSD", inline = "3", group = "Symbols")
string sym4 = input.symbol("BNBUSD", inline = "4", group = "Symbols")
string sym5 = input.symbol("SPX", inline = "5", group = "Symbols")
color col1 = input.color(#22d17c, "", inline = "1", group = "Symbols")
color col2 = input.color(#20b6ca, "", inline = "2", group = "Symbols")
color col3 = input.color(#c28120, "", inline = "3", group = "Symbols")
color col4 = input.color(#ccbb1f, "", inline = "4", group = "Symbols")
color col5 = input.color(#f23645, "", inline = "5", group = "Symbols")
string sym_size = input.string("Small", "Symbol Size", ["Small", "Big"], group = "Symbols")
bool show_hist = input.bool(true, "Show histogram", group = "Histogram")
color hist_up = input.color(#22d17c, "+", inline = "hist", group = "Histogram")
color hist_dn = input.color(#f23645, "-", inline = "hist", group = "Histogram")
bool show_info = input.bool(false, "Info 🛈", group = "---")
// =====================================================================================================================}
// CALCULATIONS
// ====================================================================================================================={
request_data(symbol)=>
request.security(symbol, "", [close[1], volume[1]], lookahead = barmerge.lookahead_on)
label_new(value, txt, change = true)=>
if change
label.delete(
label.new(
x = bar_index+math.round(value),
y = 0,
text = txt,
color = na,
textcolor = color.new(m_col, 50)
)[1]
)
if not change
label.delete(
label.new(
x = bar_index+Offset,
y = value,
text = txt,
color = #363a4500,
style = label.style_label_center,
textcolor = color.new(m_col, 50)
)[1]
)
line_new(value, change = true)=>
if change
line.delete(
line.new(
x1 = bar_index + value,
y1 = 4,
x2 = bar_index + value,
y2 = -4,
color = s_col,
style = line.style_dotted
)[1]
)
else
line.delete(
line.new(
x1 = bar_index,
y1 = value,
x2 = bar_index + Offset*2,
y2 = value,
color = s_col,
style = line.style_dotted
)[1]
)
ehler_loop_x_y(src, volum)=>
// Variables
var float hpa1 = na
var float hpb1 = na
var float hpc1 = na
var float hpc2 = na
var float hpc3 = na
var float ssa1 = na
var float ssb1 = na
var float ssc1 = na
var float ssc2 = na
var float ssc3 = na
var float HP = na
var float VolHP = na
var float Price = na
var float PriceMS = na
var float PriceRMS = na
var float Vol = na
var float VolMS = na
var float VolRMS = na
// Initialization
if (bar_index == 0)
sqr_2 = math.sqrt(2)
hpa1 := math.exp(-sqr_2 * math.pi / HPPeriod)
hpb1 := 2 * hpa1 * math.cos(sqr_2 * math.pi / HPPeriod)
hpc2 := hpb1
hpc3 := -hpa1 * hpa1
hpc1 := (1 + hpc2 - hpc3) / 4
ssa1 := math.exp(-sqr_2 * math.pi / LPPeriod)
ssb1 := 2 * ssa1 * math.cos(sqr_2 * math.pi / LPPeriod)
ssc2 := ssb1
ssc3 := -ssa1 * ssa1
ssc1 := 1 - ssc2 - ssc3
// Normalized Roofing Filter for Price
// 2 Pole Butterworth Highpass Filter
HP := hpc1 * (src - 2 * nz(src[1]) + nz(src[2])) + hpc2 * nz(HP[1]) + hpc3 * nz(HP[2])
if (bar_index < 3)
HP := 0
// Smooth with a Super Smoother Filter
Price := ssc1 * (HP + nz(HP[1])) / 2 + ssc2 * nz(Price[1]) + ssc3 * nz(Price[2])
if (bar_index < 3)
Price := 0
// Additional Variables
float num1 = 2.42 * math.pow(10, -2)
float num2 = 9.758 * math.pow(10, -1)
// Scale Price in terms of Standard Deviations
PriceMS := na(PriceMS) ? Price * Price : num1 * Price * Price + num2 * nz(PriceMS[1])
PriceRMS := PriceMS != 0 ? Price / math.sqrt(PriceMS) : na
// Normalized Roofing Filter for Volume
// 2 Pole Butterworth Highpass Filter
VolHP := hpc1 * (volum - 2 * nz(volum[1]) + nz(volum[2])) + hpc2 * nz(VolHP[1]) + hpc3 * nz(VolHP[2])
if (bar_index < 3)
VolHP := 0
// Smooth with a Super Smoother Filter
Vol := ssc1 * (VolHP + nz(VolHP[1])) / 2 + ssc2 * nz(Vol[1]) + ssc3 * nz(Vol[2])
if (bar_index < 3)
Vol := 0
// Scale Volume in terms of Standard Deviations
VolMS := na(VolMS) ? Vol * Vol : num1 * Vol * Vol + num2 * nz(VolMS[1])
VolRMS := VolMS != 0 ? Vol / math.sqrt(VolMS) : na
[PriceRMS, VolRMS]
// The ploting of loops
loops_ploting(float xPos, float yPos, string sym, color col,
int numSegments, int barScale, int offsetVal) =>
if barstate.islast
var tail = array.new (numSegments + 1)
for i = 0 to numSegments
float newY2 = yPos[i]
int newX2 = int(xPos[i] * barScale)
int newX1 = int(xPos[1 + i] * barScale)
float newY1 = yPos[1 + i]
newX2 := newX2 + offsetVal + bar_index
newX1 := newX1 + offsetVal + bar_index
if i < numSegments
lineWidth = int(4 * (numSegments - i) / numSegments + 1)
line.delete(array.get(tail, i))
tailSegments = line.new(newX1, newY1, newX2, newY2, color=color.new(col, 30 + i * 5),
style=line.style_solid, width=lineWidth)
array.set(tail, i, tailSegments)
pointMarker = i == 0 ? "●" : ""
symbolLabel = i == 0 ? sym : ""
if i == 0
label.delete(label.new(
newX2,
newY2,
pointMarker,
size =size.large,
color =#00000000,
textcolor =col,
style =label.style_label_center)[1])
label.delete(label.new(
newX2,
newY2,
symbolLabel,
size = sym_size == "Big" ? size.normal : size.small,
color = #00000000,
textcolor = m_col,
style = label.style_label_down)[1])
// Draw histogram
histo(price_, volume_, symbol, step = 0, show_hist)=>
if barstate.islast and show_hist
n = bar_index + 70
color1 = color.from_gradient(price_, -2, 2, hist_dn, hist_up)
color2 = color.from_gradient(volume_, -2, 2, hist_dn, hist_up)
line.delete(line.new(n+step, 0, n+step, price_, width = 15, color = color1)[1])
line.delete(line.new(n+8+step, 0, n+8+step, volume_, width = 15, color = color2)[1])
label.delete(
label.new(n+step-1, 0, symbol,
color = color(na),
style = label.style_label_lower_right,
textcolor = m_col,
size = sym_size == "Big" ? size.normal : size.small)[1]
)
label.delete(
label.new(n+step-1, price_, "Price:\n"+str.tostring(math.round(price_, 2)),
color = color(na),
style = price_ > 0 ? label.style_label_down : label.style_label_up,
textcolor = color.new(m_col, 30),
size = size.small)[1]
)
label.delete(
label.new(n+8+step, volume_, "Vol:\n"+str.tostring(math.round(volume_, 2)),
color = color(na),
style = volume_ > 0 ? label.style_label_down : label.style_label_up,
textcolor = color.new(m_col, 30),
size = size.small)[1]
)
// Request Data
[src1, vol1] = request_data(sym1)
[src2, vol2] = request_data(sym2)
[src3, vol3] = request_data(sym3)
[src4, vol4] = request_data(sym4)
[src5, vol5] = request_data(sym5)
// =====================================================================================================================}
// PLOT
// ====================================================================================================================={
if barstate.islast
step = Offset/4
line_new(step)
label_new(step, "3")
line_new(step*2)
label_new(step*2, "2")
line_new(step*3)
label_new(step*3, "1")
line_new(step*4)
label_new(step*4, "0")
line_new(step*5)
label_new(step*5, "-1")
line_new(step*6)
label_new(step*6, "-2")
line_new(step*7)
label_new(step*7, "-3")
label_new(+11, "Volume")
line_new(1, false)
label_new(1, " 1", false)
line_new(-1, false)
label_new(-1, " -1", false)
line_new(2, false)
label_new(2, " 2", false)
line_new(-2, false)
label_new(-2, " -2", false)
line_new(3, false)
label_new(3, " 3", false)
line_new(-3, false)
label_new(-3, " -3", false)
label_new(4.5, "Price", false)
// Center Lines
line.delete(line.new(bar_index + Offset, 4, bar_index + Offset, -4, color = color.new(m_col, 50), style = line.style_solid)[1])
line.delete(line.new(bar_index, 0, bar_index + Offset*2, 0, color = color.new(m_col, 50), style = line.style_solid)[1])
if show_info
var info = table.new(position.top_right, 10, 10)
info.cell(0, 0, "1. 🡅 volume and 🡅 price. Generally, this is considered a
trend continuation condition.
\n2. 🡇 volume and 🡅 price. This is generally considered
an extinguishing of demand.
\n3. 🡇 volume and 🡇 price. This is generally considered an
extinguishing of supply.
\n4. 🡅 volume and 🡇 price. This is generally considered a
continuation of a downtrend.
",
text_color = s_col,
text_halign = text.align_left)
array sym_1 = str.split(sym1, ":")
array sym_2 = str.split(sym2, ":")
array sym_3 = str.split(sym3, ":")
array sym_4 = str.split(sym4, ":")
array sym_5 = str.split(sym5, ":")
if barstate.islast and (on_5 or on_4 or on_3 or on_2 or on_1) and show_hist
line.delete(line.new(bar_index+45, 0, bar_index+210, 0, color = m_col, style = line.style_solid)[1])
line.delete(line.new(bar_index+45, 1, bar_index+210, 1, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45, 2, bar_index+210, 2, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45, 3, bar_index+210, 3, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45, 4, bar_index+210, 4, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45,-1, bar_index+210,-1, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45,-2, bar_index+210,-2, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45,-3, bar_index+210,-3, color = color.new(m_col, 70), style = line.style_dotted)[1])
line.delete(line.new(bar_index+45,-4, bar_index+210,-4, color = color.new(m_col, 70), style = line.style_dotted)[1])
int step = 30
if on_1
[price_1, volume_1] = ehler_loop_x_y(src1, vol1)
loops_ploting(volume_1, price_1, sym_1.last(),col1, 10, 25, Offset)
histo(price_1, volume_1, sym_1.last(), 0, show_hist)
if on_2
[price_2, volume_2] = ehler_loop_x_y(src2, vol2)
loops_ploting(volume_2, price_2, sym_2.last(),col2, 10, 25, Offset)
histo(price_2, volume_2, sym_2.last(), step, show_hist)
if on_3
[price_3, volume_3] = ehler_loop_x_y(src3, vol3)
loops_ploting(volume_3, price_3, sym_3.last(),col3, 10, 25, Offset)
histo(price_3, volume_3, sym_3.last(), step*2, show_hist)
if on_4
[price_4, volume_4] = ehler_loop_x_y(src4, vol4)
loops_ploting(volume_4, price_4, sym_4.last(),col4, 10, 25, Offset)
histo(price_4, volume_4, sym_4.last(), step*3, show_hist)
if on_5
[price_5, volume_5] = ehler_loop_x_y(src5, vol5)
loops_ploting(volume_5, price_5, sym_5.last(),col5, 10, 25, Offset)
histo(price_5, volume_5, sym_5.last(), step*4, show_hist)
// =====================================================================================================================}
⚠️ High Risk Warning
Trading Forex and Futures involves a very high degree of risk and may not be suitable for all investors. The high degree of leverage can result in the complete loss of your funds. These indicators are educational tools and do not guarantee profits. Please trade responsibly with capital you can afford to lose.