mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-23 17:28:06 +00:00
fix: Fixed unstable session-start noise by enforcing EMPTY_VALUE cutoff
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
//| Copyright 2026, xxxxxxxx|
|
//| Copyright 2026, xxxxxxxx|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
#property copyright "Copyright 2026, xxxxxxxx"
|
#property copyright "Copyright 2026, xxxxxxxx"
|
||||||
#property version "1.50" // Upgraded to 3 dynamic Z-Score bands (7-channel layout)
|
#property version "1.51" // Fixed unstable session-start noise by enforcing EMPTY_VALUE cutoff
|
||||||
#property description "Wyckoff-style Cointegration Bands on Main Chart."
|
#property description "Wyckoff-style Cointegration Bands on Main Chart."
|
||||||
#property description "Projects dynamic equilibrium line (Z=0), warning (Z=+-1.5), extreme (Z=+-2.0) and reversal (Z=+-2.5) bands."
|
#property description "Projects dynamic equilibrium line (Z=0), warning (Z=+-1.5), extreme (Z=+-2.0) and reversal (Z=+-2.5) bands."
|
||||||
#property indicator_chart_window
|
#property indicator_chart_window
|
||||||
@@ -379,13 +379,13 @@ int OnCalculate(const int rates_total,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--- D. Execute unified calculator math and fetch dynamic OLS parameters
|
//--- D. Execute unified calculator math and fetch dynamic OLS parameters
|
||||||
//--- By running CalculateZScore, the engine automatically populates beta, alpha, and std_dev internally
|
|
||||||
double z = g_calc.CalculateZScore(rates_total, i, active_window_size, g_sync_close_A, g_sync_close_B);
|
double z = g_calc.CalculateZScore(rates_total, i, active_window_size, g_sync_close_A, g_sync_close_B);
|
||||||
|
|
||||||
double beta = g_calc.GetBeta();
|
double beta = g_calc.GetBeta();
|
||||||
double alpha = g_calc.GetAlpha();
|
double alpha = g_calc.GetAlpha();
|
||||||
double std_dev = g_calc.GetStdDev();
|
double std_dev = g_calc.GetStdDev();
|
||||||
|
|
||||||
|
//--- FIXED: Enforce absolute EMPTY_VALUE cutoff when active window size is statistically unstable (< 15 bars)
|
||||||
if(active_window_size >= 15 && std_dev > 0.0)
|
if(active_window_size >= 15 && std_dev > 0.0)
|
||||||
{
|
{
|
||||||
// Center Line (Z=0.0 Equilibrium): A_hat = beta * B_t + alpha
|
// Center Line (Z=0.0 Equilibrium): A_hat = beta * B_t + alpha
|
||||||
@@ -407,13 +407,13 @@ int OnCalculate(const int rates_total,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BufMiddle[i] = close[i];
|
BufMiddle[i] = EMPTY_VALUE;
|
||||||
BufUpperOuter[i] = close[i];
|
BufUpperOuter[i] = EMPTY_VALUE;
|
||||||
BufLowerOuter[i] = close[i];
|
BufLowerOuter[i] = EMPTY_VALUE;
|
||||||
BufUpperInner[i] = close[i];
|
BufUpperInner[i] = EMPTY_VALUE;
|
||||||
BufLowerInner[i] = close[i];
|
BufLowerInner[i] = EMPTY_VALUE;
|
||||||
BufUpperExtreme[i] = close[i];
|
BufUpperExtreme[i] = EMPTY_VALUE;
|
||||||
BufLowerExtreme[i] = close[i];
|
BufLowerExtreme[i] = EMPTY_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user