refactor(scripts): ADVANCED ABSORPTION LOGIC

This commit is contained in:
Toh4iem9
2026-02-17 12:33:56 +01:00
parent 9654e458e9
commit 5c2ba27441
+41 -5
View File
@@ -572,19 +572,55 @@ bool RunQuantAnalysis(string sym, QuantData &data)
// COMPOSITES
// =================================================================
// Using Last Closed M15 for pattern recognition safety
// =================================================================
// ADVANCED ABSORPTION LOGIC (Wyckoff Effort/Result)
// =================================================================
// Using Last Closed M15 Bar for pattern validation
int idx_cl_mid = idx_l2 - 1;
if(idx_cl_mid >= 0 && mid_atr > 0)
{
double body = MathAbs(mid_c[idx_cl_mid] - mid_o[idx_cl_mid]);
double bar_rvol = Calc_RVOL(mid_v, InpRVOLPeriod, idx_cl_mid);
if(bar_rvol > 2.0 && body < (0.4 * mid_atr))
data.absorption = "YES";
double total_range = mid_h[idx_cl_mid] - mid_l[idx_cl_mid];
// Calculate specific bar RVOL using helper
// Note: We use a local calculator instance to be safe or reuse helper logic
CRelativeVolumeCalculator rv_calc;
rv_calc.Init(InpRVOLPeriod);
double bar_rvol = rv_calc.CalculateSingle(ArraySize(mid_v), mid_v, idx_cl_mid);
bool high_effort = (bar_rvol > 2.0);
bool low_result = (body < (0.35 * mid_atr)); // Stricter 35% ATR rule
data.absorption = "NO"; // Default
if(high_effort && low_result)
{
// Analyze Close Position relative to High-Low Range
// Position 0.0 (Low) to 1.0 (High)
double close_pos = 0.5;
if(total_range > 0)
close_pos = (mid_c[idx_cl_mid] - mid_l[idx_cl_mid]) / total_range;
if(close_pos > 0.66)
data.absorption = "BULL_ABS"; // Closing High = Demand absorbed Supply
else
if(close_pos < 0.33)
data.absorption = "BEAR_ABS"; // Closing Low = Supply absorbed Demand
else
data.absorption = "NEUT_ABS"; // Doji-like struggle
}
else
data.absorption = "NO";
if(bar_rvol > 3.5 && body < (0.6 * mid_atr))
{
// Volume Climax: Excessive volume with moderate move implies churn/exhaustion
data.absorption = "CLIMAX";
}
}
else
{
data.absorption = "-";
}
// MTF Align (Based on TSI Histogram Direction)
// + Hist = Bull pressure, - Hist = Bear pressure