fix(ai): drop the conv pooling stage - it reduced across filters, not time
FeedForwardConv emits POSITION-MAJOR output, matrix_o[out + window_out * i],
so one bar's window_out filter responses are contiguous and consecutive bars
sit window_out apart. Both pooling implementations (FeedForwardProof and
CPU_FeedForwardProof) slide FLAT over that buffer - pos = i * step, reducing
`window` CONSECUTIVE elements. On a position-major layout those neighbours
are different FILTERS of the same bar, never one filter across time.
At the shipped 3/2 the pool computed max(bar0_f0, bar0_f1, bar0_f2), then
max(bar0_f2, bar0_f3, bar0_f4), with every 8th window straddling a bar
boundary. So it collapsed unrelated feature detectors into whichever fired
hardest, passed gradient to that winner only, and halved the feature map
while doing it - all below every learnable layer, where nothing above can
recover it. The removed inputs' own labels ("3 Bars") show time-axis pooling
was the intent throughout.
Measured cost: CONV sat pinned at ~40% balanced accuracy for 510 eras with
Sell recall 0%, while plain MLPs on the same data reached 57-61%. HYBRID,
which also carried this stage, came second-worst of the batch-norm group.
Not fixable in the topology: pooling one filter across time needs a stride
of window_out BETWEEN samples within a window, which a consecutive-window
kernel cannot express at any window/step. That needs a stride-aware kernel
in Network.cl + WarriorCPU.cpp + WarriorDML.cpp and a DLL rebuild, and is
only worth doing if a conv front-end earns its place without downsampling
first - with 20 sliding positions there is little to gain by halving them.
ConvPoolWindow/ConvPoolStep and their enums are removed with it, along with
the |CP: fingerprint term added earlier today.
Both builds compile 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 19:28:44 -04:00
|
|
|
//+------------------------------------------------------------------+
|
2026-07-13 03:23:39 -04:00
|
|
|
//| CustomEnums.mqh |
|
|
|
|
|
//| AnimateDread |
|
|
|
|
|
//| https://www.mql5.com |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
#property copyright "AnimateDread"
|
|
|
|
|
#property link "https://www.mql5.com"
|
2026-07-22 17:17:23 -04:00
|
|
|
//--- Weight-update optimizer. This is really an AI\Network.mqh library type; a guarded duplicate is
|
|
|
|
|
//--- kept here so Variables\Inputs.mqh (which uses it for the TrainingOptimizer input) can be included
|
|
|
|
|
//--- before the AI headers - putting the EA's own inputs at the top of the Inputs tab. Keep in sync
|
|
|
|
|
//--- with AI\Network.mqh's copy; the shared WARRIOR_ENUM_OPTIMIZATION_DEFINED guard prevents a
|
|
|
|
|
//--- duplicate definition whichever header is parsed first.
|
|
|
|
|
#ifndef WARRIOR_ENUM_OPTIMIZATION_DEFINED
|
|
|
|
|
#define WARRIOR_ENUM_OPTIMIZATION_DEFINED
|
2026-07-29 00:03:54 -04:00
|
|
|
//--- A third DFA entry was removed 2026-07-28 - see AI\Network.mqh's copy for the full rationale (it was
|
|
|
|
|
//--- a deterministic index-parity sign flip on the gradient, i.e. ascent on half of every weight tensor,
|
|
|
|
|
//--- not Direct Feedback Alignment). SGD/ADAM keep ordinals 0/1: they feed the weights-filename
|
|
|
|
|
//--- fingerprint and must never be renumbered.
|
2026-07-22 17:17:23 -04:00
|
|
|
enum ENUM_OPTIMIZATION
|
|
|
|
|
{
|
|
|
|
|
SGD, // SGD + Momentum (heavy-ball, simpler, needs more eras)
|
2026-07-29 00:03:54 -04:00
|
|
|
ADAM // Adam (adaptive step, faster convergence, can overfit)
|
2026-07-22 17:17:23 -04:00
|
|
|
};
|
|
|
|
|
#endif
|
2026-07-22 22:51:04 -04:00
|
|
|
//--- Logical, commonly-used Moving Average / RSI periods only - keeps the Classic Signals inputs (and
|
|
|
|
|
//--- the AutoTuneIndicators search space over them, see ADIndicatorTuner.mqh) from being set/perturbed
|
|
|
|
|
//--- to an arbitrary, non-standard period.
|
|
|
|
|
enum MA_PERIOD_PRESETS
|
|
|
|
|
{
|
|
|
|
|
MA_PERIOD_5 = 5, // 5
|
|
|
|
|
MA_PERIOD_8 = 8, // 8
|
|
|
|
|
MA_PERIOD_9 = 9, // 9
|
|
|
|
|
MA_PERIOD_10 = 10, // 10
|
|
|
|
|
MA_PERIOD_13 = 13, // 13
|
|
|
|
|
MA_PERIOD_20 = 20, // 20
|
|
|
|
|
MA_PERIOD_21 = 21, // 21
|
|
|
|
|
MA_PERIOD_50 = 50, // 50
|
|
|
|
|
MA_PERIOD_100 = 100, // 100
|
|
|
|
|
MA_PERIOD_200 = 200, // 200
|
|
|
|
|
};
|
feat(indicators): run the built-in iMA and MetaTrader's ZigZag; add a classic-vote shift
MA: CustomIndicators\ADMovingAverage is replaced by the built-in iMA (CiMA) on
both consumers - the classic vote and the NN MA input feature. This drops the
five advanced types ALMA/DEMA/ZLEMA/T3/Kalman, which have no iMA equivalent;
MA_TYPE_PRESETS is now ENUM_MA_METHOD's own codes and the tuner searches all
four. It also removes a documented failure mode: a custom indicator's depth is
bounded by TERMINAL_MAXBARS, and m_MA was the one whose feature block REJECTS
the bar on a short read - the "feature 25 fails on every bar" incident of
2026-08-17. A built-in is served at any depth.
MIGRATION. SMA moves from code 5 to 0, so persisted type codes change meaning.
SanitizeMaType() is the single validity rule; TunedPeriods records now carry a
version field and a v1 record remaps 5..8 -> 0..3, falling back to SMA for a
stored advanced type (unrecoverable - old 0..4 are indistinguishable from valid
new codes). Existing .nnw files re-key on their own, because MA_Type is hashed
into the topology fingerprint, so models retrain rather than silently running
on different MA values. EXPECT A FULL RETRAIN.
ZigZag: ADZigZag was a byte-identical rename of MetaQuotes' Examples\ZigZag -
verified by normalising identifiers and stripping comments, 233 significant
lines each with only renamed symbols differing. It now loads the stock one, so
nothing is bundled and MetaQuotes' fixes arrive without a rebuild here. Both
#resource entries are gone.
Classic_Shift: a new input, the BAR the four classic votes evaluate on (0 =
forming, 1 = last closed, default 1). One implementation on CExpertSignalCustom,
inherited by all four rather than repeated per module. Defaults to a sentinel
meaning "unset", so the AI signals and the aggregate keep the stock every_tick
rule and their feature/label alignment is untouched. The META corpus sweep still
takes precedence. CExpertBase::StartIndex turns out to be virtual, so this is a
real override, not the name-hiding the old comment claimed.
Not compiled - MetaEditor compile pending.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:09:58 -04:00
|
|
|
//--- Moving-average TYPE. VALUES ARE ENUM_MA_METHOD's own codes and MUST stay in sync with it - both the
|
|
|
|
|
//--- classic MA vote (Signals\SignalMA.mqh) and the NN MA input feature now run the BUILT-IN iMA via
|
|
|
|
|
//--- CiMA, so a value here is passed straight through as the ma_method argument. Auto-tuner-searchable.
|
|
|
|
|
//---
|
|
|
|
|
//--- 2026-08-19: replaced CustomIndicators\ADMovingAverage. That indicator offered five extra types
|
|
|
|
|
//--- (ALMA/DEMA/ZLEMA/T3/Kalman) on codes 0..4 with SMA/EMA/SMMA/LWMA on 5..8; those five have no iMA
|
|
|
|
|
//--- equivalent and are GONE, and the four survivors renumbered to match ENUM_MA_METHOD. Anything that
|
|
|
|
|
//--- persists a type code across that boundary must migrate - see LoadTunedPeriods().
|
feat: add unified MA type support to indicator tuner
Add `MA_TYPE_PRESETS` enum covering advanced (ALMA, DEMA, ZLEMA, T3, Kalman) and standard (SMA, EMA, SMMA, LWMA) moving averages. Integrate `maType` and `bestMaType` into `CADIndicatorTuner` struct, update flatten/unflatten routines, and bump `AD_TUNE_PARAM_COUNT` to 33. This allows the auto-tuner to search over MA type alongside period, improving feature discovery.
2026-07-23 15:02:09 -04:00
|
|
|
enum MA_TYPE_PRESETS
|
|
|
|
|
{
|
feat(indicators): run the built-in iMA and MetaTrader's ZigZag; add a classic-vote shift
MA: CustomIndicators\ADMovingAverage is replaced by the built-in iMA (CiMA) on
both consumers - the classic vote and the NN MA input feature. This drops the
five advanced types ALMA/DEMA/ZLEMA/T3/Kalman, which have no iMA equivalent;
MA_TYPE_PRESETS is now ENUM_MA_METHOD's own codes and the tuner searches all
four. It also removes a documented failure mode: a custom indicator's depth is
bounded by TERMINAL_MAXBARS, and m_MA was the one whose feature block REJECTS
the bar on a short read - the "feature 25 fails on every bar" incident of
2026-08-17. A built-in is served at any depth.
MIGRATION. SMA moves from code 5 to 0, so persisted type codes change meaning.
SanitizeMaType() is the single validity rule; TunedPeriods records now carry a
version field and a v1 record remaps 5..8 -> 0..3, falling back to SMA for a
stored advanced type (unrecoverable - old 0..4 are indistinguishable from valid
new codes). Existing .nnw files re-key on their own, because MA_Type is hashed
into the topology fingerprint, so models retrain rather than silently running
on different MA values. EXPECT A FULL RETRAIN.
ZigZag: ADZigZag was a byte-identical rename of MetaQuotes' Examples\ZigZag -
verified by normalising identifiers and stripping comments, 233 significant
lines each with only renamed symbols differing. It now loads the stock one, so
nothing is bundled and MetaQuotes' fixes arrive without a rebuild here. Both
#resource entries are gone.
Classic_Shift: a new input, the BAR the four classic votes evaluate on (0 =
forming, 1 = last closed, default 1). One implementation on CExpertSignalCustom,
inherited by all four rather than repeated per module. Defaults to a sentinel
meaning "unset", so the AI signals and the aggregate keep the stock every_tick
rule and their feature/label alignment is untouched. The META corpus sweep still
takes precedence. CExpertBase::StartIndex turns out to be virtual, so this is a
real override, not the name-hiding the old comment claimed.
Not compiled - MetaEditor compile pending.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:09:58 -04:00
|
|
|
MA_TYPE_SMA = MODE_SMA, // SMA (simple)
|
|
|
|
|
MA_TYPE_EMA = MODE_EMA, // EMA (exponential)
|
|
|
|
|
MA_TYPE_SMMA = MODE_SMMA, // SMMA (smoothed)
|
|
|
|
|
MA_TYPE_LWMA = MODE_LWMA, // LWMA (linear weighted)
|
feat: add unified MA type support to indicator tuner
Add `MA_TYPE_PRESETS` enum covering advanced (ALMA, DEMA, ZLEMA, T3, Kalman) and standard (SMA, EMA, SMMA, LWMA) moving averages. Integrate `maType` and `bestMaType` into `CADIndicatorTuner` struct, update flatten/unflatten routines, and bump `AD_TUNE_PARAM_COUNT` to 33. This allows the auto-tuner to search over MA type alongside period, improving feature discovery.
2026-07-23 15:02:09 -04:00
|
|
|
};
|
feat(indicators): run the built-in iMA and MetaTrader's ZigZag; add a classic-vote shift
MA: CustomIndicators\ADMovingAverage is replaced by the built-in iMA (CiMA) on
both consumers - the classic vote and the NN MA input feature. This drops the
five advanced types ALMA/DEMA/ZLEMA/T3/Kalman, which have no iMA equivalent;
MA_TYPE_PRESETS is now ENUM_MA_METHOD's own codes and the tuner searches all
four. It also removes a documented failure mode: a custom indicator's depth is
bounded by TERMINAL_MAXBARS, and m_MA was the one whose feature block REJECTS
the bar on a short read - the "feature 25 fails on every bar" incident of
2026-08-17. A built-in is served at any depth.
MIGRATION. SMA moves from code 5 to 0, so persisted type codes change meaning.
SanitizeMaType() is the single validity rule; TunedPeriods records now carry a
version field and a v1 record remaps 5..8 -> 0..3, falling back to SMA for a
stored advanced type (unrecoverable - old 0..4 are indistinguishable from valid
new codes). Existing .nnw files re-key on their own, because MA_Type is hashed
into the topology fingerprint, so models retrain rather than silently running
on different MA values. EXPECT A FULL RETRAIN.
ZigZag: ADZigZag was a byte-identical rename of MetaQuotes' Examples\ZigZag -
verified by normalising identifiers and stripping comments, 233 significant
lines each with only renamed symbols differing. It now loads the stock one, so
nothing is bundled and MetaQuotes' fixes arrive without a rebuild here. Both
#resource entries are gone.
Classic_Shift: a new input, the BAR the four classic votes evaluate on (0 =
forming, 1 = last closed, default 1). One implementation on CExpertSignalCustom,
inherited by all four rather than repeated per module. Defaults to a sentinel
meaning "unset", so the AI signals and the aggregate keep the stock every_tick
rule and their feature/label alignment is untouched. The META corpus sweep still
takes precedence. CExpertBase::StartIndex turns out to be virtual, so this is a
real override, not the name-hiding the old comment claimed.
Not compiled - MetaEditor compile pending.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 19:09:58 -04:00
|
|
|
//--- The ONE validity rule for a persisted MA type code. iMA rejects anything outside ENUM_MA_METHOD,
|
|
|
|
|
//--- and a stored code can predate the ADMovingAverage removal, so every load path runs it through
|
|
|
|
|
//--- here. Old codes 5..8 were SMA/EMA/SMMA/LWMA and map cleanly; old 0..4 were the five advanced
|
|
|
|
|
//--- types that no longer exist and are indistinguishable from valid new codes, so they cannot be
|
|
|
|
|
//--- rescued - callers that know they are reading a pre-migration file pass legacy=true to convert.
|
|
|
|
|
int SanitizeMaType(const int stored, const bool legacy)
|
|
|
|
|
{
|
|
|
|
|
if(legacy)
|
|
|
|
|
return (stored >= 5 && stored <= 8) ? stored - 5 : (int)MA_TYPE_SMA;
|
|
|
|
|
return (stored >= MODE_SMA && stored <= MODE_LWMA) ? stored : (int)MA_TYPE_SMA;
|
|
|
|
|
}
|
2026-07-22 22:51:04 -04:00
|
|
|
enum RSI_PERIOD_PRESETS
|
|
|
|
|
{
|
|
|
|
|
RSI_PERIOD_2 = 2, // 2
|
|
|
|
|
RSI_PERIOD_5 = 5, // 5
|
|
|
|
|
RSI_PERIOD_7 = 7, // 7
|
|
|
|
|
RSI_PERIOD_9 = 9, // 9
|
2026-07-26 18:48:34 -04:00
|
|
|
RSI_PERIOD_14 = 14, // 14 (classic)
|
2026-07-22 22:51:04 -04:00
|
|
|
RSI_PERIOD_21 = 21, // 21
|
|
|
|
|
RSI_PERIOD_25 = 25, // 25
|
|
|
|
|
};
|
2026-07-26 18:33:12 -04:00
|
|
|
//--- MACD periods (Signals\SignalMACD.mqh classic vote + the MACD input feature). The preset SETS are
|
|
|
|
|
//--- deliberately chosen so that EVERY fast/slow combination satisfies CSignalMACD::ValidationSettings()'s
|
|
|
|
|
//--- "slow must exceed fast" rule - the fast list tops out at 15, the slow list starts at 17. A trader
|
|
|
|
|
//--- picking two legal-looking values from the dropdowns can therefore never produce a combination that
|
|
|
|
|
//--- fails init, and the auto-tuner (ADIndicatorTuner::PerturbRandom) can perturb either one in isolation
|
|
|
|
|
//--- without having to know the other's current value.
|
|
|
|
|
enum MACD_FAST_PRESETS
|
|
|
|
|
{
|
|
|
|
|
MACD_FAST_5 = 5, // 5
|
|
|
|
|
MACD_FAST_8 = 8, // 8
|
|
|
|
|
MACD_FAST_12 = 12, // 12 (classic)
|
|
|
|
|
MACD_FAST_15 = 15, // 15
|
|
|
|
|
};
|
|
|
|
|
enum MACD_SLOW_PRESETS
|
|
|
|
|
{
|
|
|
|
|
MACD_SLOW_17 = 17, // 17
|
|
|
|
|
MACD_SLOW_21 = 21, // 21
|
|
|
|
|
MACD_SLOW_26 = 26, // 26 (classic)
|
|
|
|
|
MACD_SLOW_34 = 34, // 34
|
|
|
|
|
MACD_SLOW_50 = 50, // 50
|
|
|
|
|
};
|
|
|
|
|
enum MACD_SIGNAL_PRESETS
|
|
|
|
|
{
|
|
|
|
|
MACD_SIGNAL_5 = 5, // 5
|
|
|
|
|
MACD_SIGNAL_7 = 7, // 7
|
|
|
|
|
MACD_SIGNAL_9 = 9, // 9 (classic)
|
|
|
|
|
MACD_SIGNAL_12 = 12, // 12
|
|
|
|
|
};
|
|
|
|
|
//--- Ichimoku periods (Signals\SignalIchimoku.mqh classic vote + the Ichimoku input feature). Same
|
|
|
|
|
//--- all-combinations-are-legal design as the MACD presets above, against
|
|
|
|
|
//--- CSignalIchimoku::ValidationSettings()'s "Tenkan < Kijun < Senkou B" rule: Tenkan tops out at 20,
|
|
|
|
|
//--- Kijun spans 22-40, Senkou B starts at 44. The classic 9/26/52 triple is in the middle of each.
|
|
|
|
|
enum ICHIMOKU_TENKAN_PRESETS
|
|
|
|
|
{
|
|
|
|
|
ICHI_TENKAN_7 = 7, // 7
|
|
|
|
|
ICHI_TENKAN_9 = 9, // 9 (classic)
|
|
|
|
|
ICHI_TENKAN_12 = 12, // 12
|
|
|
|
|
ICHI_TENKAN_20 = 20, // 20
|
|
|
|
|
};
|
|
|
|
|
enum ICHIMOKU_KIJUN_PRESETS
|
|
|
|
|
{
|
|
|
|
|
ICHI_KIJUN_22 = 22, // 22
|
|
|
|
|
ICHI_KIJUN_26 = 26, // 26 (classic)
|
|
|
|
|
ICHI_KIJUN_30 = 30, // 30
|
|
|
|
|
ICHI_KIJUN_40 = 40, // 40
|
|
|
|
|
};
|
|
|
|
|
enum ICHIMOKU_SENKOU_PRESETS
|
|
|
|
|
{
|
|
|
|
|
ICHI_SENKOU_44 = 44, // 44
|
|
|
|
|
ICHI_SENKOU_52 = 52, // 52 (classic)
|
|
|
|
|
ICHI_SENKOU_60 = 60, // 60
|
|
|
|
|
ICHI_SENKOU_120 = 120, // 120
|
|
|
|
|
};
|
2026-07-13 03:23:39 -04:00
|
|
|
//--- custom enumerations for certain settings, minimizes overfitting
|
|
|
|
|
enum IND_PERIODS_PRESETS
|
|
|
|
|
{
|
|
|
|
|
PERIOD_5 = 5, // 5 Periods
|
|
|
|
|
PERIOD_10 = 10, // 10 Periods
|
2026-07-26 18:48:34 -04:00
|
|
|
PERIOD_14 = 14, // 14 Periods (classic)
|
2026-07-13 03:23:39 -04:00
|
|
|
PERIOD_20 = 20, // 20 Periods
|
|
|
|
|
PERIOD_30 = 30, // 30 Periods
|
|
|
|
|
PERIOD_50 = 50, // 50 Periods
|
|
|
|
|
PERIOD_100 = 100, // 100 Periods
|
|
|
|
|
PERIOD_200 = 200, // 200 Periods
|
|
|
|
|
};
|
|
|
|
|
enum TRAINING_YEARS_PRESET
|
|
|
|
|
{
|
|
|
|
|
YEARS_1 = 1, // 1 year
|
|
|
|
|
YEARS_2 = 2, // 2 years
|
|
|
|
|
YEARS_5 = 5, // 5 years
|
|
|
|
|
YEARS_10 = 10, // 10 years
|
|
|
|
|
YEARS_20 = 20, // 20 years
|
|
|
|
|
};
|
feat(trade): anchor SL and TP to the entry price, not the last swing
Stops keyed to the recent swing extreme make a trade's risk a function of
how far the last swing happens to sit rather than of current volatility. On
a shallow pullback the swing sits close to the fill, so the stop is tight
enough to be taken out by noise on setups that then run to target - which is
what the Perceptron's signals were showing.
SL: lowest_low/highest_high -/+ mult*ATR -> entry -/+ mult*ATR
TP: TP_PREV_SWING (opposite swing) -> removed; ATR-from-entry
SL_PREV_SWING, TP_PREV_SWING -> removed from the enums
The SL anchors to `price` (the resolved entry), not to base_price: with a
pending entry those differ by the whole entry offset, and the risk Money
sizes against is entry-to-stop.
MIN_SL_ATR_MULTIPLIER 2.0 -> 0.5. That floor existed because a swing-
anchored stop could land arbitrarily close to the entry and needed a bound
unrelated to the chosen multiple. An entry-anchored stop is exactly
mult*ATR by construction and cannot collapse, so leaving it at 2.0 would
have silently overridden SL_ATR_x1 to 2*ATR - making the input a lie AND
forcing TP >= 4*ATR just to clear the default 1:2 rejection filter. The
broker's own stop level is enforced separately and precisely by
TCAdjustStops(), so this is now a pure sanity net.
Default TP_Mode TP_PREV_SWING -> TP_ATR_x3, so SL_ATR_x1 + TP_ATR_x3 gives a
realised 3:1 against the 1:2 filter. TP_ATR_x2 would sit EXACTLY on the 2.0
boundary where price-normalization rounding alone can reject the setup; the
default leaves a deliberate gap. This is the same interaction that once
rejected 100% of setups on every symbol (see TP_INTELLIGENT_BASE_RR).
Swing validity guards now reject only when the configuration actually uses a
swing - i.e. ENTRY_PREV_SWING. Previously an unsynced or thin history
rejected EVERY trade, including configurations whose levels no longer
reference a swing at all. The guards are kept, not deleted: a bad swing must
still never reach an entry price, and iLow/iHigh are no longer called with a
possibly-negative index.
TP_INTELLIGENT stays risk-relative. Now that risk is exactly mult*ATR the
risk- and ATR-relative forms coincide, but risk-relative keeps its
reward:risk guarantee exact after the floor or TCAdjustStops widens a stop.
Both builds compile 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 10:11:13 -04:00
|
|
|
//--- Stop-loss sizing mode. The ATR_* presets place the SL a fixed multiple of ATR FROM THE ENTRY
|
|
|
|
|
//--- PRICE. SL_INTELLIGENT uses the same entry anchor but tightens the distance as live AI/DB
|
|
|
|
|
//--- confidence rises (see CExpertSignalCustom::OpenParams()'s AI_SL_TIGHTEN_FACTOR) - a
|
|
|
|
|
//--- high-conviction setup gets a tighter stop, a marginal one keeps the full ATR cushion. Negative
|
|
|
|
|
//--- sentinel so it can never be mistaken for a literal ATR multiple.
|
|
|
|
|
//--- SWING-ANCHORED STOPS WERE REMOVED 2026-07-31. Both the ATR presets ("N ATR beyond the swing") and
|
|
|
|
|
//--- SL_PREV_SWING ("exactly at the swing") keyed the stop to the recent swing high/low, which makes
|
|
|
|
|
//--- the risk on a trade a function of how far away the last swing happens to sit rather than of
|
|
|
|
|
//--- current volatility: a shallow pullback produced a stop tight enough to be taken out by noise on a
|
|
|
|
|
//--- setup that then ran to target. Anchoring to the entry makes risk exactly N*ATR by construction,
|
2026-08-09 14:51:59 -04:00
|
|
|
//--- which is also what kept the old minimum-reward:risk rejection satisfiable without depending on
|
|
|
|
|
//--- swing geometry. That filter is gone (2026-08-09); the coupling is still the right shape.
|
refactor(inputs): 96 -> 70 inputs; remove two untested/unusable filter modules
Every removal below is FINGERPRINT-NEUTRAL by construction: each retired
input is pinned to the exact value it already shipped with, so running
models keep their filenames and resume rather than restarting at era 0.
Verified field by field against BuildConfigFingerprint.
Removed as inputs, kept as pinned constants (the value was never a
preference the user had a basis to change):
- OutputNeuronsCount. The regression head predicts a continuous quantity
the triple-barrier label does not contain; the target is an EVENT, so
the right output is its probability. The regression code paths stay
implemented and dormant - they cost nothing and removing them would
touch every scoring path at once.
- MinRecall. A safety floor, not a preference, and the only direction a
user can move it is the harmful one: raising it past what the config
reaches yields NO model, not a better one (observed repeatedly at 60).
- SwingConfirmationBars. Stopped gating the labels with the relabel, but
is STILL load-bearing for the swing-context input features - it is the
ZigZag repainting embargo, and without it those 9 features read a leg
the live bar could not have had yet. Pinned, not deleted.
- MaxErasPerRun (runaway backstop, never reached in a healthy run),
FreezePriorCalibration (unanswerable by a user; near-balanced labels
make the priors stable anyway), VerboseMode (developer view, joins
DebuggingMode), MACD/Ichimoku periods x6 (both indicators ship
disabled, and as optimizer dimensions they are pure overfitting
surface - the AI auto-tuner is the supported way to move them).
- SignalClusterWindow -> 3, no longer an input. Barrier labels make
consecutive setups real, which argued for 0; it is not 0 because on D1+
a 6-bar window spans over a week and two arrows a day apart on a
weekly-scale move are one event. 3 splits it correctly by timeframe.
- EnableOnlineLearning -> ON. Adapting to a changing market is what keeps
a months-attached model from going stale, and the rolling-accuracy
freeze is what makes it safe. See the caveat noted in the handoff: it
had not been forward-tested on a live feed when this became default.
Removed entirely:
- Intraday Time Filter (5 inputs + Signals/SignalITF.mqh). Two of its
five inputs were raw BITMASKS, which is an implementation detail
exposed as a control. The job is covered three times over by things
that are declarative or that learn: the session filter, the
time-of-day/day-of-week input features (the network discovers which
hours are good rather than being told), and the journal's time buckets.
- Market Depth Filter (5 inputs + Signals/SignalMarketDepth.mqh, plus
its OnInit probe and OnDeinit release). It needs real level-2 data
that this broker - and most retail MT5 brokers - do not provide, so
the module has never once executed against real data. Shipping four
tuning dropdowns for an untested path is worse than shipping nothing:
the only users who could enable it would be its first-ever testers,
live. If DOM returns it should be a FEATURE fed to the network, not a
rule-based veto with hand-tuned thresholds - imbalance is data.
- IndicatorTuneTrials, replaced by ComputeTuneTrialBudget(). The useful
budget depends on how many parameters are actually being searched,
which depends on which features are enabled - so one number meant
wildly different things run to run. The shipped 32 was ~10 candidates
per dimension against one enabled indicator (wasteful: each costs
GA_SEEDS full training runs) and under one per dimension against all
nine (blind). Now population ~ 4 x active dimensions, clamped [8,64],
with CADIndicatorTuner::ActiveDimensions() defined immediately above
PerturbRandom() so the two cannot drift apart.
- Six orphaned enums (TUNE_TRIALS_PRESET, DOM_*, ENTRY_HOUR_OF_DAY,
TIME_FILTER_DAY_OF_WEEK), 81 lines.
Other UX:
- SL_ATR_x1 / TP_ATR_x3 now carry the "(classic)" default marker every
other preset enum in the file already used. Nothing in the SL/TP
dropdowns previously told a user which pair was the shipped default -
which matters far more since the relabel, because those two define the
labels and changing either forces a retrain.
- Neural Network section moved directly ABOVE AI Input Features: choose
the architecture, then choose what it sees. NN Optimizer / Performance
stays last - the Adam/Sgd inputs are declared in AI/Network.mqh and
render immediately after that divider.
- News feature + window moved to the end of the AI feature list, below
Wyckoff Bar Inversion.
- Dropped "(0-100)" from Min vote to open - it is an enum, not a number.
Both builds compile 0 errors / 0 warnings. No retrain forced.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 21:22:02 -04:00
|
|
|
//--- The "(classic)" marker on the shipped default follows the same convention as every period preset
|
|
|
|
|
//--- below. It matters more here than anywhere else in this file: since the 2026-08-01 triple-barrier
|
|
|
|
|
//--- relabel, SL_Mode and TP_Mode DEFINE THE TRAINING LABELS, so they are in the weights-filename
|
|
|
|
|
//--- fingerprint and changing either one re-keys the model and starts a fresh retrain. A user needs to
|
|
|
|
|
//--- be able to see which pair the shipped model was actually trained on.
|
2026-07-22 13:33:56 -04:00
|
|
|
enum STOP_LOSS_MODE
|
|
|
|
|
{
|
|
|
|
|
SL_INTELLIGENT = -1, // Intelligent (AI-confidence scaled)
|
perf(autotune): replace the genetic search with a filter score - hours to seconds
MEASURED COST OF THE GA, which is what retired it. Per generation:
rung 0: 8 cand x 3 seeds x 3 eras = 72 eras
rung 1: 4 cand x 3 seeds x 8 eras = 96
rung 2: 2 cand x 3 seeds x 20 eras = 120
= 288 eras/generation x 4 generations = 1152 eras BEFORE the winner's
real training began. Against the observed era times on SP500 H1:
PAI 29.1 s/era -> 9.3 h (matches the observed 00:37 -> 09:22)
CONV 41.3 s/era -> 13.2 h
LSTM 150.4 s/era -> 48.1 h
HYBRID 154.6 s/era -> 49.5 h
Two days to tune is not a first-run experience, and it is the phase in
which the panel goes quiet, which is what made it look like a hang.
It also bought nothing. The space is 90 points (10 MA periods x 9 MA
types), so 1152 evaluations revisited each point ~13 times; and rungs of
3 and 8 eras cannot separate two MA periods at all. The 2026-08-01 run
proves it: every finalist scored 25.0-25.9% balanced accuracy - below the
33.3% one-class floor, i.e. indistinguishable noise - and the search then
"deployed the winner" of that.
THE ERROR WAS THE SCORING FUNCTION, not its constants. Using a full
training run to choose a feature's period is a wrapper method paying
wrapper prices for a decision that does not need one. The reference book
does not do this: ch. 3.3 selects inputs by measuring each candidate
indicator's CORRELATION with the target and dropping the ones with none,
with no network involved.
So: rank candidates by the MUTUAL INFORMATION between the resulting
feature vector and the triple-barrier label. MI rather than correlation
because the label is 3-class categorical and the features are not
monotonically related to it. Equal-FREQUENCY binning (rank-based),
because these features are ATR-normalised and heavy-tailed - fixed-width
bins put nearly everything in one bucket and report ~0 information for a
genuinely useful feature.
Scoring is arithmetic over the feature cache, so it costs seconds and its
cost is independent of topology: LSTM now tunes as fast as the MLP.
Coordinate sweep, not product sweep - cost is the SUM of per-parameter
candidate counts, so enabling every indicator stays affordable - with a
second pass that breaks early once nothing moves.
Sampling is IS-ONLY. Letting the OOS window influence which indicator
settings ship would mean the holdout had been used for selection and had
stopped being a holdout.
HONEST LIMIT, recorded because it is the price: MI is marginal, so a
parameter that only pays off in combination with another can be missed
(Guyon & Elisseeff 2003, filter vs wrapper). Given the wrapper it
replaces was ranking pure noise at 48 h a run, this is strictly better.
Deleted with it: GaRungEras/GaExtract/GaStore/GaMutate/GaRandomCandidate/
GaBlockCrossover/GaSortAliveByScoreDesc/GaBreedNextGeneration, 14 m_ga*
members, the GA_*/TUNE_POP_* constants, and ComputeTuneTrialBudget.
AND m_evalMode/m_evalEraBudget, because nothing set them any more - 28
read sites all permanently inert. That is not a tidy-up: the `if
(!m_evalMode)` guard on UpdateClassPriors is exactly what silently
disabled the imbalance correction for entire runs two commits ago. Dead
machinery that still reads like live machinery is this codebase's most
expensive recurring bug, and leaving 28 more instances of it would have
been indefensible.
The panel's tuning-progress state goes too - tuning no longer takes long
enough to need one.
Both builds compile 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 10:29:31 -04:00
|
|
|
SL_ATR_x1 = 1, // ATR * 1 from entry
|
feat(trade): anchor SL and TP to the entry price, not the last swing
Stops keyed to the recent swing extreme make a trade's risk a function of
how far the last swing happens to sit rather than of current volatility. On
a shallow pullback the swing sits close to the fill, so the stop is tight
enough to be taken out by noise on setups that then run to target - which is
what the Perceptron's signals were showing.
SL: lowest_low/highest_high -/+ mult*ATR -> entry -/+ mult*ATR
TP: TP_PREV_SWING (opposite swing) -> removed; ATR-from-entry
SL_PREV_SWING, TP_PREV_SWING -> removed from the enums
The SL anchors to `price` (the resolved entry), not to base_price: with a
pending entry those differ by the whole entry offset, and the risk Money
sizes against is entry-to-stop.
MIN_SL_ATR_MULTIPLIER 2.0 -> 0.5. That floor existed because a swing-
anchored stop could land arbitrarily close to the entry and needed a bound
unrelated to the chosen multiple. An entry-anchored stop is exactly
mult*ATR by construction and cannot collapse, so leaving it at 2.0 would
have silently overridden SL_ATR_x1 to 2*ATR - making the input a lie AND
forcing TP >= 4*ATR just to clear the default 1:2 rejection filter. The
broker's own stop level is enforced separately and precisely by
TCAdjustStops(), so this is now a pure sanity net.
Default TP_Mode TP_PREV_SWING -> TP_ATR_x3, so SL_ATR_x1 + TP_ATR_x3 gives a
realised 3:1 against the 1:2 filter. TP_ATR_x2 would sit EXACTLY on the 2.0
boundary where price-normalization rounding alone can reject the setup; the
default leaves a deliberate gap. This is the same interaction that once
rejected 100% of setups on every symbol (see TP_INTELLIGENT_BASE_RR).
Swing validity guards now reject only when the configuration actually uses a
swing - i.e. ENTRY_PREV_SWING. Previously an unsynced or thin history
rejected EVERY trade, including configurations whose levels no longer
reference a swing at all. The guards are kept, not deleted: a bad swing must
still never reach an entry price, and iLow/iHigh are no longer called with a
possibly-negative index.
TP_INTELLIGENT stays risk-relative. Now that risk is exactly mult*ATR the
risk- and ATR-relative forms coincide, but risk-relative keeps its
reward:risk guarantee exact after the floor or TCAdjustStops widens a stop.
Both builds compile 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 10:11:13 -04:00
|
|
|
SL_ATR_x2 = 2, // ATR * 2 from entry
|
|
|
|
|
SL_ATR_x3 = 3, // ATR * 3 from entry
|
2026-07-22 13:33:56 -04:00
|
|
|
};
|
|
|
|
|
//--- Take-profit sizing mode. The ATR_* presets set the TP a fixed multiple of ATR FROM THE ENTRY
|
2026-08-09 14:51:59 -04:00
|
|
|
//--- PRICE (no longer derived from the reward:risk ratio - that ratio was a pure
|
feat(trade): anchor SL and TP to the entry price, not the last swing
Stops keyed to the recent swing extreme make a trade's risk a function of
how far the last swing happens to sit rather than of current volatility. On
a shallow pullback the swing sits close to the fill, so the stop is tight
enough to be taken out by noise on setups that then run to target - which is
what the Perceptron's signals were showing.
SL: lowest_low/highest_high -/+ mult*ATR -> entry -/+ mult*ATR
TP: TP_PREV_SWING (opposite swing) -> removed; ATR-from-entry
SL_PREV_SWING, TP_PREV_SWING -> removed from the enums
The SL anchors to `price` (the resolved entry), not to base_price: with a
pending entry those differ by the whole entry offset, and the risk Money
sizes against is entry-to-stop.
MIN_SL_ATR_MULTIPLIER 2.0 -> 0.5. That floor existed because a swing-
anchored stop could land arbitrarily close to the entry and needed a bound
unrelated to the chosen multiple. An entry-anchored stop is exactly
mult*ATR by construction and cannot collapse, so leaving it at 2.0 would
have silently overridden SL_ATR_x1 to 2*ATR - making the input a lie AND
forcing TP >= 4*ATR just to clear the default 1:2 rejection filter. The
broker's own stop level is enforced separately and precisely by
TCAdjustStops(), so this is now a pure sanity net.
Default TP_Mode TP_PREV_SWING -> TP_ATR_x3, so SL_ATR_x1 + TP_ATR_x3 gives a
realised 3:1 against the 1:2 filter. TP_ATR_x2 would sit EXACTLY on the 2.0
boundary where price-normalization rounding alone can reject the setup; the
default leaves a deliberate gap. This is the same interaction that once
rejected 100% of setups on every symbol (see TP_INTELLIGENT_BASE_RR).
Swing validity guards now reject only when the configuration actually uses a
swing - i.e. ENTRY_PREV_SWING. Previously an unsynced or thin history
rejected EVERY trade, including configurations whose levels no longer
reference a swing at all. The guards are kept, not deleted: a bad swing must
still never reach an entry price, and iLow/iHigh are no longer called with a
possibly-negative index.
TP_INTELLIGENT stays risk-relative. Now that risk is exactly mult*ATR the
risk- and ATR-relative forms coincide, but risk-relative keeps its
reward:risk guarantee exact after the floor or TCAdjustStops widens a stop.
Both builds compile 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 10:11:13 -04:00
|
|
|
//--- rejection filter). TP_INTELLIGENT scales the target UP with confidence (lets high-conviction
|
|
|
|
|
//--- winners run further). Negative sentinel as above.
|
|
|
|
|
//--- TP_PREV_SWING REMOVED 2026-07-31 alongside the swing-anchored stops: targeting the opposite swing
|
|
|
|
|
//--- caps the reward at whatever structure happens to be overhead, which on a trending signal exits
|
|
|
|
|
//--- well before the move is done and, paired with a swing-anchored stop, made the realised
|
|
|
|
|
//--- reward:risk a property of the chart's geometry rather than of the setup.
|
2026-07-22 13:33:56 -04:00
|
|
|
enum TAKE_PROFIT_MODE
|
|
|
|
|
{
|
|
|
|
|
TP_INTELLIGENT = -1, // Intelligent (AI-confidence scaled)
|
|
|
|
|
TP_ATR_x1 = 1, // ATR * 1 from entry
|
|
|
|
|
TP_ATR_x2 = 2, // ATR * 2 from entry
|
perf(autotune): replace the genetic search with a filter score - hours to seconds
MEASURED COST OF THE GA, which is what retired it. Per generation:
rung 0: 8 cand x 3 seeds x 3 eras = 72 eras
rung 1: 4 cand x 3 seeds x 8 eras = 96
rung 2: 2 cand x 3 seeds x 20 eras = 120
= 288 eras/generation x 4 generations = 1152 eras BEFORE the winner's
real training began. Against the observed era times on SP500 H1:
PAI 29.1 s/era -> 9.3 h (matches the observed 00:37 -> 09:22)
CONV 41.3 s/era -> 13.2 h
LSTM 150.4 s/era -> 48.1 h
HYBRID 154.6 s/era -> 49.5 h
Two days to tune is not a first-run experience, and it is the phase in
which the panel goes quiet, which is what made it look like a hang.
It also bought nothing. The space is 90 points (10 MA periods x 9 MA
types), so 1152 evaluations revisited each point ~13 times; and rungs of
3 and 8 eras cannot separate two MA periods at all. The 2026-08-01 run
proves it: every finalist scored 25.0-25.9% balanced accuracy - below the
33.3% one-class floor, i.e. indistinguishable noise - and the search then
"deployed the winner" of that.
THE ERROR WAS THE SCORING FUNCTION, not its constants. Using a full
training run to choose a feature's period is a wrapper method paying
wrapper prices for a decision that does not need one. The reference book
does not do this: ch. 3.3 selects inputs by measuring each candidate
indicator's CORRELATION with the target and dropping the ones with none,
with no network involved.
So: rank candidates by the MUTUAL INFORMATION between the resulting
feature vector and the triple-barrier label. MI rather than correlation
because the label is 3-class categorical and the features are not
monotonically related to it. Equal-FREQUENCY binning (rank-based),
because these features are ATR-normalised and heavy-tailed - fixed-width
bins put nearly everything in one bucket and report ~0 information for a
genuinely useful feature.
Scoring is arithmetic over the feature cache, so it costs seconds and its
cost is independent of topology: LSTM now tunes as fast as the MLP.
Coordinate sweep, not product sweep - cost is the SUM of per-parameter
candidate counts, so enabling every indicator stays affordable - with a
second pass that breaks early once nothing moves.
Sampling is IS-ONLY. Letting the OOS window influence which indicator
settings ship would mean the holdout had been used for selection and had
stopped being a holdout.
HONEST LIMIT, recorded because it is the price: MI is marginal, so a
parameter that only pays off in combination with another can be missed
(Guyon & Elisseeff 2003, filter vs wrapper). Given the wrapper it
replaces was ranking pure noise at 48 h a run, this is strictly better.
Deleted with it: GaRungEras/GaExtract/GaStore/GaMutate/GaRandomCandidate/
GaBlockCrossover/GaSortAliveByScoreDesc/GaBreedNextGeneration, 14 m_ga*
members, the GA_*/TUNE_POP_* constants, and ComputeTuneTrialBudget.
AND m_evalMode/m_evalEraBudget, because nothing set them any more - 28
read sites all permanently inert. That is not a tidy-up: the `if
(!m_evalMode)` guard on UpdateClassPriors is exactly what silently
disabled the imbalance correction for entire runs two commits ago. Dead
machinery that still reads like live machinery is this codebase's most
expensive recurring bug, and leaving 28 more instances of it would have
been indefensible.
The panel's tuning-progress state goes too - tuning no longer takes long
enough to need one.
Both builds compile 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 10:29:31 -04:00
|
|
|
TP_ATR_x3 = 3, // ATR * 3 from entry
|
2026-07-22 13:33:56 -04:00
|
|
|
TP_ATR_x4 = 4, // ATR * 4 from entry
|
|
|
|
|
TP_ATR_x6 = 6, // ATR * 6 from entry
|
|
|
|
|
TP_ATR_x8 = 8, // ATR * 8 from entry
|
|
|
|
|
TP_ATR_x10 = 10, // ATR * 10 from entry
|
|
|
|
|
};
|
2026-08-09 14:51:59 -04:00
|
|
|
//--- RISK_REWARD_RATIO removed 2026-08-09 along with its only consumer, the Min_Risk_Reward_Ratio
|
|
|
|
|
//--- input. Deleted rather than left dangling: a live enum with no input behind it is exactly the shape
|
|
|
|
|
//--- of the 2026-07 incident where a saved .set kept feeding a deleted option's ordinal back in and
|
|
|
|
|
//--- trained ~250 eras on the wrong target (MT5 does not validate saved enum inputs). See
|
|
|
|
|
//--- Variables\Inputs.mqh for why the ratio itself had to go.
|
2026-07-13 03:23:39 -04:00
|
|
|
enum MONEY_RISK_PERCENT_PRESET
|
|
|
|
|
{
|
perf(autotune): replace the genetic search with a filter score - hours to seconds
MEASURED COST OF THE GA, which is what retired it. Per generation:
rung 0: 8 cand x 3 seeds x 3 eras = 72 eras
rung 1: 4 cand x 3 seeds x 8 eras = 96
rung 2: 2 cand x 3 seeds x 20 eras = 120
= 288 eras/generation x 4 generations = 1152 eras BEFORE the winner's
real training began. Against the observed era times on SP500 H1:
PAI 29.1 s/era -> 9.3 h (matches the observed 00:37 -> 09:22)
CONV 41.3 s/era -> 13.2 h
LSTM 150.4 s/era -> 48.1 h
HYBRID 154.6 s/era -> 49.5 h
Two days to tune is not a first-run experience, and it is the phase in
which the panel goes quiet, which is what made it look like a hang.
It also bought nothing. The space is 90 points (10 MA periods x 9 MA
types), so 1152 evaluations revisited each point ~13 times; and rungs of
3 and 8 eras cannot separate two MA periods at all. The 2026-08-01 run
proves it: every finalist scored 25.0-25.9% balanced accuracy - below the
33.3% one-class floor, i.e. indistinguishable noise - and the search then
"deployed the winner" of that.
THE ERROR WAS THE SCORING FUNCTION, not its constants. Using a full
training run to choose a feature's period is a wrapper method paying
wrapper prices for a decision that does not need one. The reference book
does not do this: ch. 3.3 selects inputs by measuring each candidate
indicator's CORRELATION with the target and dropping the ones with none,
with no network involved.
So: rank candidates by the MUTUAL INFORMATION between the resulting
feature vector and the triple-barrier label. MI rather than correlation
because the label is 3-class categorical and the features are not
monotonically related to it. Equal-FREQUENCY binning (rank-based),
because these features are ATR-normalised and heavy-tailed - fixed-width
bins put nearly everything in one bucket and report ~0 information for a
genuinely useful feature.
Scoring is arithmetic over the feature cache, so it costs seconds and its
cost is independent of topology: LSTM now tunes as fast as the MLP.
Coordinate sweep, not product sweep - cost is the SUM of per-parameter
candidate counts, so enabling every indicator stays affordable - with a
second pass that breaks early once nothing moves.
Sampling is IS-ONLY. Letting the OOS window influence which indicator
settings ship would mean the holdout had been used for selection and had
stopped being a holdout.
HONEST LIMIT, recorded because it is the price: MI is marginal, so a
parameter that only pays off in combination with another can be missed
(Guyon & Elisseeff 2003, filter vs wrapper). Given the wrapper it
replaces was ranking pure noise at 48 h a run, this is strictly better.
Deleted with it: GaRungEras/GaExtract/GaStore/GaMutate/GaRandomCandidate/
GaBlockCrossover/GaSortAliveByScoreDesc/GaBreedNextGeneration, 14 m_ga*
members, the GA_*/TUNE_POP_* constants, and ComputeTuneTrialBudget.
AND m_evalMode/m_evalEraBudget, because nothing set them any more - 28
read sites all permanently inert. That is not a tidy-up: the `if
(!m_evalMode)` guard on UpdateClassPriors is exactly what silently
disabled the imbalance correction for entire runs two commits ago. Dead
machinery that still reads like live machinery is this codebase's most
expensive recurring bug, and leaving 28 more instances of it would have
been indefensible.
The panel's tuning-progress state goes too - tuning no longer takes long
enough to need one.
Both builds compile 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 10:29:31 -04:00
|
|
|
RISK_PCT_1 = 1, // 1
|
2026-07-13 03:23:39 -04:00
|
|
|
RISK_PCT_2 = 2, // 2
|
|
|
|
|
RISK_PCT_3 = 3, // 3
|
|
|
|
|
RISK_PCT_4 = 4, // 4
|
|
|
|
|
RISK_PCT_5 = 5, // 5
|
|
|
|
|
};
|
|
|
|
|
enum BARS_EXPIRATION
|
|
|
|
|
{
|
|
|
|
|
BARS_X1 = 1, // 1 Candle
|
|
|
|
|
BARS_X2 = 2, // 2 Candles
|
|
|
|
|
BARS_X3 = 3, // 3 Candles
|
|
|
|
|
BARS_X5 = 5, // 5 Candles
|
|
|
|
|
BARS_X10 = 10, // 10 Candles
|
|
|
|
|
BARS_X20 = 20, // 20 Candles
|
|
|
|
|
};
|
2026-07-22 13:33:56 -04:00
|
|
|
//--- Entry order placement. All ATR offsets are measured from the CURRENT price (bid/ask), NOT the
|
|
|
|
|
//--- swing - this is the deliberate change for stability. Sign picks the side, magnitude is the ATR
|
|
|
|
|
//--- multiple:
|
|
|
|
|
//--- MARKET - fill immediately at market.
|
|
|
|
|
//--- LIMIT_*xATR - pending LIMIT that many ATR on the favorable side of bid/ask (buy below /
|
|
|
|
|
//--- sell above): wait for a pullback into a better price.
|
|
|
|
|
//--- STOP_*xATR - pending STOP that many ATR on the breakout side of bid/ask (buy above /
|
|
|
|
|
//--- sell below): enter on continuation.
|
|
|
|
|
//--- ENTRY_PREV_SWING - pending order anchored at the recent swing (buy at the lookback swing low /
|
|
|
|
|
//--- sell at the swing high) - the one swing-anchored option kept as a choice.
|
|
|
|
|
//--- ENTRY_INTELLIGENT - AI-confidence-scaled LIMIT pullback from bid/ask: a deep pullback when
|
|
|
|
|
//--- confidence is low, collapsing to a market fill as confidence -> 1 (grab
|
|
|
|
|
//--- high-conviction setups, demand a better price on marginal ones).
|
|
|
|
|
//--- Non-MARKET results that clear the broker's stop-level distance become a pending order that
|
|
|
|
|
//--- auto-expires after Signal_Expiration bars; anything closer just fills at market
|
|
|
|
|
//--- (CExpertTrade::Buy/Sell handle the market-vs-limit-vs-stop routing off this price natively).
|
2026-07-13 03:23:39 -04:00
|
|
|
enum ENTRY_MULTIPLIER
|
|
|
|
|
{
|
2026-07-22 13:33:56 -04:00
|
|
|
ENTRY_INTELLIGENT = -100, // Intelligent (AI-confidence scaled limit pullback)
|
perf(autotune): replace the genetic search with a filter score - hours to seconds
MEASURED COST OF THE GA, which is what retired it. Per generation:
rung 0: 8 cand x 3 seeds x 3 eras = 72 eras
rung 1: 4 cand x 3 seeds x 8 eras = 96
rung 2: 2 cand x 3 seeds x 20 eras = 120
= 288 eras/generation x 4 generations = 1152 eras BEFORE the winner's
real training began. Against the observed era times on SP500 H1:
PAI 29.1 s/era -> 9.3 h (matches the observed 00:37 -> 09:22)
CONV 41.3 s/era -> 13.2 h
LSTM 150.4 s/era -> 48.1 h
HYBRID 154.6 s/era -> 49.5 h
Two days to tune is not a first-run experience, and it is the phase in
which the panel goes quiet, which is what made it look like a hang.
It also bought nothing. The space is 90 points (10 MA periods x 9 MA
types), so 1152 evaluations revisited each point ~13 times; and rungs of
3 and 8 eras cannot separate two MA periods at all. The 2026-08-01 run
proves it: every finalist scored 25.0-25.9% balanced accuracy - below the
33.3% one-class floor, i.e. indistinguishable noise - and the search then
"deployed the winner" of that.
THE ERROR WAS THE SCORING FUNCTION, not its constants. Using a full
training run to choose a feature's period is a wrapper method paying
wrapper prices for a decision that does not need one. The reference book
does not do this: ch. 3.3 selects inputs by measuring each candidate
indicator's CORRELATION with the target and dropping the ones with none,
with no network involved.
So: rank candidates by the MUTUAL INFORMATION between the resulting
feature vector and the triple-barrier label. MI rather than correlation
because the label is 3-class categorical and the features are not
monotonically related to it. Equal-FREQUENCY binning (rank-based),
because these features are ATR-normalised and heavy-tailed - fixed-width
bins put nearly everything in one bucket and report ~0 information for a
genuinely useful feature.
Scoring is arithmetic over the feature cache, so it costs seconds and its
cost is independent of topology: LSTM now tunes as fast as the MLP.
Coordinate sweep, not product sweep - cost is the SUM of per-parameter
candidate counts, so enabling every indicator stays affordable - with a
second pass that breaks early once nothing moves.
Sampling is IS-ONLY. Letting the OOS window influence which indicator
settings ship would mean the holdout had been used for selection and had
stopped being a holdout.
HONEST LIMIT, recorded because it is the price: MI is marginal, so a
parameter that only pays off in combination with another can be missed
(Guyon & Elisseeff 2003, filter vs wrapper). Given the wrapper it
replaces was ranking pure noise at 48 h a run, this is strictly better.
Deleted with it: GaRungEras/GaExtract/GaStore/GaMutate/GaRandomCandidate/
GaBlockCrossover/GaSortAliveByScoreDesc/GaBreedNextGeneration, 14 m_ga*
members, the GA_*/TUNE_POP_* constants, and ComputeTuneTrialBudget.
AND m_evalMode/m_evalEraBudget, because nothing set them any more - 28
read sites all permanently inert. That is not a tidy-up: the `if
(!m_evalMode)` guard on UpdateClassPriors is exactly what silently
disabled the imbalance correction for entire runs two commits ago. Dead
machinery that still reads like live machinery is this codebase's most
expensive recurring bug, and leaving 28 more instances of it would have
been indefensible.
The panel's tuning-progress state goes too - tuning no longer takes long
enough to need one.
Both builds compile 0 errors / 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-01 10:29:31 -04:00
|
|
|
//ENTRY_PREV_SWING = -101, // Pending at previous swing low (buy) / swing high (sell)
|
2026-07-22 13:33:56 -04:00
|
|
|
LIMIT_3xATR = -3, // Limit 3x ATR from bid/ask
|
|
|
|
|
LIMIT_2xATR = -2, // Limit 2x ATR from bid/ask
|
|
|
|
|
LIMIT_1xATR = -1, // Limit 1x ATR from bid/ask
|
|
|
|
|
MARKET = 0, // Market order
|
|
|
|
|
STOP_1xATR = 1, // Stop 1x ATR from bid/ask
|
|
|
|
|
STOP_2xATR = 2, // Stop 2x ATR from bid/ask
|
|
|
|
|
STOP_3xATR = 3, // Stop 3x ATR from bid/ask
|
2026-07-13 03:23:39 -04:00
|
|
|
};
|
|
|
|
|
enum TRAILING_STRATEGY
|
|
|
|
|
{
|
|
|
|
|
TRAILING_STRATEGY_NONE, // No Trailing Stop Strategy
|
|
|
|
|
TRAILING_STRATEGY_ATR_x1, // ATR * 1 Trailing Strategy
|
|
|
|
|
TRAILING_STRATEGY_ATR_x2, // ATR * 2 Trailing Strategy
|
|
|
|
|
TRAILING_STRATEGY_ATR_x3, // ATR * 3 Trailing Strategy
|
2026-07-22 13:33:56 -04:00
|
|
|
//--- Confidence-adaptive ATR trail: widens toward TRAIL_ATR_MAX_MULT when live AI confidence still
|
|
|
|
|
//--- backs the position (lets winners run), tightens toward TRAIL_ATR_MIN_MULT as that confidence
|
|
|
|
|
//--- weakens or flips against it (locks profit). See Trailing\TrailingIntelligent.mqh.
|
|
|
|
|
TRAILING_STRATEGY_INTELLIGENT, // Intelligent (AI-confidence adaptive ATR) Trailing Strategy
|
2026-07-13 03:23:39 -04:00
|
|
|
};
|
|
|
|
|
enum MONEY_MANAGEMENT_STRATEGY
|
|
|
|
|
{
|
|
|
|
|
FIXED_RISK, // Fixed risk Percent of Account
|
|
|
|
|
INTELLIGENT, // Intelligent lot size
|
|
|
|
|
FIXED_LOT, // Fixed lot size
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum CLOSE_HOUR_OF_DAY
|
|
|
|
|
{
|
|
|
|
|
CLOSE_HOUR_DISABLED = -1, // Disabled
|
|
|
|
|
CH_0 = 0, // 00Hxx
|
|
|
|
|
CH_1 = 1, // 1Hxx
|
|
|
|
|
CH_2 = 2, // 2Hxx
|
|
|
|
|
CH_3 = 3, // 3Hxx
|
|
|
|
|
CH_4 = 4, // 4Hxx
|
|
|
|
|
CH_5 = 5, // 5Hxx
|
|
|
|
|
CH_6 = 6, // 6Hxx
|
|
|
|
|
CH_7 = 7, // 7Hxx
|
|
|
|
|
CH_8 = 8, // 8Hxx
|
|
|
|
|
CH_9 = 9, // 9Hxx
|
|
|
|
|
CH_10 = 10, // 10Hxx
|
|
|
|
|
CH_11 = 11, // 11Hxx
|
|
|
|
|
CH_12 = 12, // 12Hxx
|
|
|
|
|
CH_13 = 13, // 13Hxx
|
|
|
|
|
CH_14 = 14, // 14Hxx
|
|
|
|
|
CH_15 = 15, // 15Hxx
|
|
|
|
|
CH_16 = 16, // 16Hxx
|
|
|
|
|
CH_17 = 17, // 17Hxx
|
|
|
|
|
CH_18 = 18, // 18Hxx
|
|
|
|
|
CH_19 = 19, // 19Hxx
|
|
|
|
|
CH_20 = 20, // 20Hxx
|
|
|
|
|
CH_21 = 21, // 21Hxx
|
|
|
|
|
CH_22 = 22, // 22Hxx
|
|
|
|
|
CH_23 = 23, // 23Hxx
|
feat(sessions): market-hours entry gate + "Market close" close-all option, both live from the symbol's session table
Two user requests, one authority: SymbolInfoSessionTrade, read fresh on
every call so DST and per-symbol schedule changes track themselves.
- WarriorMarketOpenNow(): CheckOpenPosition refuses entries outside the
symbol's trading sessions (Sunday reopen, index CFDs' daily breaks) -
a vote can no longer fire into a closed book and collect a broker
error. ENTRIES ONLY: exits, SL/TP and the scheduled close-all stay
unguarded - closing risk must never be blocked by a session boundary.
- CH_MARKET_CLOSE = 24 (appended, .set-safe): the close-all fires
"Close-all minute" minutes before that day's LAST session close.
Friday + Market close + xxH05 = flatten 5 minutes before Friday's
actual close. Resolved identically in three places: the live executor
(CExpertCustom::OnTick), the label walk's vertical barrier
(NextScheduledCloseAll - the symbol's CURRENT table stands in for
history; MT5 keeps none, and a fixed hour is wrong by more), and the
fingerprint (the |CUT: token already carries hour=24, so switching to
the dynamic mode re-keys the model exactly like any schedule change).
Training itself is deliberately NOT gated on market hours: weekend
compute is free and labels only ever exist on real bars - what the
session table gates is order placement and, via the close-all barrier,
what the labels may count as holdable.
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 11:34:27 -04:00
|
|
|
//--- Resolves per day from the SYMBOL'S OWN trading-session table (SymbolInfoSessionTrade),
|
|
|
|
|
//--- so it follows the broker through DST and per-symbol schedules with nothing to retune:
|
|
|
|
|
//--- the close-all fires "Close-all minute" minutes BEFORE that day's last session close
|
|
|
|
|
//--- (e.g. minute = xxH05 -> 5 minutes before the close). The label walk resolves the same
|
|
|
|
|
//--- value (Expert\AIBase\Labels.mqh), so training and the live book share one definition of
|
|
|
|
|
//--- "the day ends". Explicit 24: impossible as a literal hour, appended (values are saved,
|
|
|
|
|
//--- never validated - members are only ever added at the end).
|
|
|
|
|
CH_MARKET_CLOSE = 24, // Market close (minus Close-all minute)
|
2026-07-13 03:23:39 -04:00
|
|
|
};
|
|
|
|
|
enum CLOSE_MINUTE_OF_HOUR
|
|
|
|
|
{
|
|
|
|
|
CLOSE_MINUTE_DISABLED = -1,// Disabled
|
|
|
|
|
CM_0 = 0, // xxH00
|
|
|
|
|
CM_5 = 5, // xxH05
|
|
|
|
|
CM_10 = 10, // xxH10
|
|
|
|
|
CM_15 = 15, // xxH15
|
|
|
|
|
CM_20 = 20, // xxH20
|
|
|
|
|
CM_25 = 25, // xxH25
|
|
|
|
|
CM_30 = 30, // xxH30
|
|
|
|
|
CM_35 = 35, // xxH35
|
|
|
|
|
CM_40 = 40, // xxH40
|
|
|
|
|
CM_45 = 45, // xxH45
|
|
|
|
|
CM_50 = 50, // xxH50
|
|
|
|
|
CM_55 = 55, // xxH55
|
|
|
|
|
CM_60 = 60, // xxH60
|
|
|
|
|
};
|
|
|
|
|
enum CLOSE_DAY_OF_WEEK
|
|
|
|
|
{
|
|
|
|
|
CLOSE_DAY_DISABLED = -1, // Disabled
|
|
|
|
|
CLOSE_MONDAY = 1, // Monday
|
|
|
|
|
CLOSE_TUESDAY = 2, // Tuesday
|
|
|
|
|
CLOSE_WEDNESDAY = 3, // Wednesday
|
|
|
|
|
CLOSE_THURSDAY = 4, // Thursday
|
|
|
|
|
CLOSE_FRIDAY = 5, // Friday
|
|
|
|
|
CLOSE_EVERYDAY, // Every Day
|
|
|
|
|
};
|
|
|
|
|
enum NF_LOOKBACK_PRESETS
|
|
|
|
|
{
|
|
|
|
|
NF_DISABLED = -1, // Disabled
|
|
|
|
|
M5 = 5, // 5 Minutes
|
|
|
|
|
M15 = 15, // 15 Minutes
|
|
|
|
|
M30 = 30, // 30 Minutes
|
|
|
|
|
M45 = 45, // 45 Minutes
|
|
|
|
|
M60 = 60, // 1 Hour
|
|
|
|
|
M120 = 120, // 2 Hours
|
|
|
|
|
M240 = 240, // 4 Hours
|
|
|
|
|
};
|
|
|
|
|
enum NF_IMPACT_PRESETS
|
|
|
|
|
{
|
|
|
|
|
HOLIDAYS = 0, //Holidays
|
|
|
|
|
LOW = 1, // Low Impact News
|
|
|
|
|
MEDIUM = 2, // Medium Impact News
|
|
|
|
|
HIGH = 3, // High Impact News
|
|
|
|
|
};
|
feat(direction): INTELLIGENT trade direction - the measured drift picks the side(s)
SQX EdgeFinder precedent (user request): adjust for the drift instead of
fighting it. The 2026-08-19 telemetry found the models leaning SHORT
(Buy recall 21% vs Sell 40%) against a long-favored market (always-long
34.3% vs always-short 29.5% at the adopted geometry).
TRADING_DIRECTION gains INTELLIGENT = 3 (appended, explicit value,
.set-safe). It resolves at runtime from the label cache's per-side win
rates - the Buy/Sell shares ARE the win rates of taking every bar
long/short at the REAL stop/target with spread charged. A side is
dropped only when BOTH hold: the drift gap clears 2 combined SEs on the
overlap-deflated effective sample (EffectiveSampleSize - labels overlap
~18x), AND the weaker side sits below cost-adjusted break-even (a side
that still clears costs is kept; drift tilt alone is not a reason to
refuse a profitable side). Fails open to BOTH: unmeasured, tiny
effective n (<30), insignificant gap, or classic-only charts (no label
cache).
One resolution point - WarriorEffectiveDirection() - feeds all three
gates so they cannot drift apart: CheckOpenLong/Short (live entries),
the filtered-view sweep (a blocked side falls into the delete branch,
mirroring live), and the vote HUD's "-> TRADE" verdict. The verdict
re-derives at every label-cache rebuild, prints only on change, and is
computed even when the input is not Intelligent (marked informational).
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 11:10:05 -04:00
|
|
|
//--- INTELLIGENT added 2026-08-19 (user request, SQX EdgeFinder precedent: "adjust for the drift
|
|
|
|
|
//--- to increase success rate"). It resolves to LONG_ONLY / SHORT_ONLY / BOTH at runtime from the
|
|
|
|
|
//--- label cache's measured per-side win rates at the REAL geometry (the verdict block in
|
|
|
|
|
//--- Expert\AIBase\Labels.mqh): a side is dropped only when the drift gap clears 2 combined SEs
|
|
|
|
|
//--- on the overlap-deflated sample AND that side sits below cost-adjusted break-even. BOTH until
|
|
|
|
|
//--- measured; classic-only charts (no label cache) never resolve past BOTH. Appended with an
|
|
|
|
|
//--- explicit value - MT5 saves enum VALUES and never validates them, so members are only ever
|
|
|
|
|
//--- added at the end, never renumbered.
|
fix(build): four compile faults - one was a SILENT enum collision that inverted the direction policy
Reported by the user's MetaEditor compile of f64e0f8 (26 errors, 4 warnings). The four
warnings mattered more than the errors.
1. INTELLIGENT WAS TWO ENUMS. MONEY_MANAGEMENT_STRATEGY::INTELLIGENT (=1) is declared
BEFORE TRADING_DIRECTION::INTELLIGENT (=3) in InputEnums.mqh, so MQL5 resolved every
'tradingdirection == INTELLIGENT' to the MM member and converted it to value 1 =
TRADING_DIRECTION::LONG_ONLY. Wrong in both directions at once: selecting Intelligent
(3) matched NOTHING and silently traded both sides, while selecting Long only (1)
matched and handed the decision to the measured drift verdict - which can answer
SHORT_ONLY, so the one setting that must never go short could have. Reported by the
compiler as a WARNING only, never an error. Renamed to DIRECTION_INTELLIGENT; the
VALUE stays 3, so saved .set files are unaffected. Swept every enum in the repo for
sibling collisions (38 enums, detector validated against the pre-fix source, which it
flags): none remain.
2. g_warriorMetaGate sits above the class it points at - added the forward declaration,
the same pattern g_warriorEnsemble already uses in ExpertSignalAIBase.mqh.
3. The broker-time rename (b63e39f) never reached BufferNewTickSignal's PARAMETER or its
two call sites: the local became brokerTime, the parameter stayed gmtTime, and the
body was rewritten to read brokerTime. All five sites now agree.
4. ConfigureAISignal calls IsMetaTarget() from a free function - moved it to the public
section (identity, not an implementation seam); the other meta seams stay protected.
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:16:45 -04:00
|
|
|
//--- NAMED DIRECTION_INTELLIGENT, NOT the bare `INTELLIGENT` (compiler-caught 2026-08-19, before
|
|
|
|
|
//--- this ever ran): MONEY_MANAGEMENT_STRATEGY already owns that name and is declared FIRST in
|
|
|
|
|
//--- this file, so MQL5 resolved every `tradingdirection == INTELLIGENT` to THAT enum's value 1 -
|
|
|
|
|
//--- which is TRADING_DIRECTION::LONG_ONLY. The behaviour was wrong in both directions at once:
|
|
|
|
|
//--- selecting "Intelligent" (3) matched nothing and silently traded BOTH sides, while selecting
|
|
|
|
|
//--- "Long only" (1) matched and handed the decision to the measured drift verdict - which can
|
|
|
|
|
//--- answer SHORT_ONLY, i.e. the one setting that must never go short could. MQL5 reports this as
|
|
|
|
|
//--- a WARNING only ("implicit conversion ... LONG_ONLY will be used instead"), never an error, so
|
|
|
|
|
//--- the NAME is the thing that has to stay unique - a cross-enum collision cannot be caught by
|
|
|
|
|
//--- reading either enum alone. The VALUE stays 3: saved .set files are unaffected by a rename.
|
2026-07-13 03:23:39 -04:00
|
|
|
enum TRADING_DIRECTION
|
|
|
|
|
{
|
fix(build): four compile faults - one was a SILENT enum collision that inverted the direction policy
Reported by the user's MetaEditor compile of f64e0f8 (26 errors, 4 warnings). The four
warnings mattered more than the errors.
1. INTELLIGENT WAS TWO ENUMS. MONEY_MANAGEMENT_STRATEGY::INTELLIGENT (=1) is declared
BEFORE TRADING_DIRECTION::INTELLIGENT (=3) in InputEnums.mqh, so MQL5 resolved every
'tradingdirection == INTELLIGENT' to the MM member and converted it to value 1 =
TRADING_DIRECTION::LONG_ONLY. Wrong in both directions at once: selecting Intelligent
(3) matched NOTHING and silently traded both sides, while selecting Long only (1)
matched and handed the decision to the measured drift verdict - which can answer
SHORT_ONLY, so the one setting that must never go short could have. Reported by the
compiler as a WARNING only, never an error. Renamed to DIRECTION_INTELLIGENT; the
VALUE stays 3, so saved .set files are unaffected. Swept every enum in the repo for
sibling collisions (38 enums, detector validated against the pre-fix source, which it
flags): none remain.
2. g_warriorMetaGate sits above the class it points at - added the forward declaration,
the same pattern g_warriorEnsemble already uses in ExpertSignalAIBase.mqh.
3. The broker-time rename (b63e39f) never reached BufferNewTickSignal's PARAMETER or its
two call sites: the local became brokerTime, the parameter stayed gmtTime, and the
body was rewritten to read brokerTime. All five sites now agree.
4. ConfigureAISignal calls IsMetaTarget() from a free function - moved it to the public
section (identity, not an implementation seam); the other meta seams stay protected.
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:16:45 -04:00
|
|
|
BOTH, // Allow both long and short trades
|
|
|
|
|
LONG_ONLY, // Allow only long (buy) trades
|
|
|
|
|
SHORT_ONLY, // Allow only short (sell) trades
|
|
|
|
|
DIRECTION_INTELLIGENT = 3, // Intelligent - measured drift picks the side(s)
|
2026-07-13 03:23:39 -04:00
|
|
|
};
|
|
|
|
|
|
refactor(stdlib): the vote thresholds are ints on the library's scale, not "confidence %"
The MECHANISM was already stdlib and is untouched: ThresholdOpen() ->
m_threshold_open, tested as `m_direction >= m_threshold_open` exactly as
CExpertSignal does it. What was wrong was the presentation. Both inputs
were preset ENUMS labelled "Min confidence to open/close (%)", which
names the wrong quantity - m_direction is a WEIGHTED MEAN OF PATTERN
WEIGHTS, not a probability, and nothing in this path is a confidence.
They are now plain ints named the way the MQL5 wizard names them:
input int Signal_ThresholdOpen = 25; // [0...100]
input int Signal_ThresholdClose = 101; // [0...100, 101 = never]
Values are exactly what shipped, so behaviour is unchanged. 101 rather
than the library's default of 100 for close: a weighted mean of pattern
weights cannot REACH 101, which is how the shipped config disables the
vote exit, and quietly lowering it to 100 would re-arm a live exit route
as a side effect of a naming change.
VOTE_CLOSE_PRESETS is deleted (its only user is gone). PERCENTAGE_PRESETS
stays - MinRecall genuinely is a percentage.
** ACTION NEEDED ON DEPLOYED CHARTS: the inputs are RENAMED, so saved
.set files no longer match and charts fall back to the defaults above.
Those defaults are the current shipped values, so a chart on 25/Disabled
needs nothing; a tuned one does.
Comment cleanup in the same pass, and this part was not cosmetic - three
blocks documented mechanisms that no longer exist:
- the AI early-exit route (deleted in 38a12a2) described as live and
still firing every bar;
- the m_lastNonNeutralSignal alternation gate (removed 2026-08-01)
described as consuming the AI's vote;
- 16 lines of VOTE_CLOSE_PRESETS documentation orphaned by that enum's
deletion, ending with "see that enum's note directly above" pointing
at nothing.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 08:39:01 -04:00
|
|
|
//--- 5-POINT STEPS BELOW 50, 10-POINT ABOVE (2026-08-19). This is Signal_ThresholdOpen's scale, and under
|
2026-08-19 08:25:49 -04:00
|
|
|
//--- CONSENSUS arithmetic the votes it must separate are quantized by AGREEMENT: with four members
|
|
|
|
|
//--- whose tiers self-rank to pooled win rates ~29, unanimity reads ~29, 3-of-4 ~22, 2-of-4 ~14.5.
|
|
|
|
|
//--- The old 10-point grid straddled every rung the ensemble can express - 20 admitted 3-of-4 and
|
|
|
|
|
//--- 30 admitted nothing - so the thresholds an operator actually wants, which sit BETWEEN rungs,
|
|
|
|
|
//--- did not exist on the dropdown. Steps stay coarse above 50 because nothing reachable lives up
|
|
|
|
|
//--- there until pooled skill does. Members are ADDED, never removed or renumbered: MT5 saves the
|
|
|
|
|
//--- VALUE and does not validate it against the current enum (see the RISK_LIMIT_PCT_PRESET
|
|
|
|
|
//--- removal note at the bottom of this file), so adding explicit-valued members is .set-safe
|
|
|
|
|
//--- while deleting one is the trained-250-eras-on-the-wrong-target failure.
|
2026-07-13 03:23:39 -04:00
|
|
|
enum PERCENTAGE_PRESETS
|
|
|
|
|
{
|
2026-08-19 08:25:49 -04:00
|
|
|
PCT_5 = 5, // 5%
|
2026-07-13 03:23:39 -04:00
|
|
|
PCT_10 = 10, // 10%
|
2026-08-19 08:25:49 -04:00
|
|
|
PCT_15 = 15, // 15%
|
2026-07-13 03:23:39 -04:00
|
|
|
PCT_20 = 20, // 20%
|
2026-08-19 08:25:49 -04:00
|
|
|
PCT_25 = 25, // 25%
|
2026-07-13 03:23:39 -04:00
|
|
|
PCT_30 = 30, // 30%
|
2026-08-19 08:25:49 -04:00
|
|
|
PCT_35 = 35, // 35%
|
2026-07-13 03:23:39 -04:00
|
|
|
PCT_40 = 40, // 40%
|
2026-08-19 08:25:49 -04:00
|
|
|
PCT_45 = 45, // 45%
|
2026-07-13 03:23:39 -04:00
|
|
|
PCT_50 = 50, // 50%
|
|
|
|
|
PCT_60 = 60, // 60%
|
|
|
|
|
PCT_70 = 70, // 70%
|
|
|
|
|
PCT_80 = 80, // 80%
|
|
|
|
|
PCT_90 = 90, // 90%
|
|
|
|
|
PCT_100 = 100, // 100%
|
|
|
|
|
};
|
feat(ui): thresholds pick from a dropdown, and the finder arrows are back beside the level lines
Two UX changes the operator asked for.
THRESHOLDS. Signal_ThresholdOpen/Close were raw ints with the legal range
written in the label ("[0...100, 101 = never]") - the one input style this
codebase converted away from everywhere else. Open now takes the existing
PERCENTAGE_PRESETS, whose comment already declared itself to be "Signal_
ThresholdOpen's scale" but was never wired to it; Close takes a new
SIGNAL_CLOSE_PRESETS carrying the same rungs plus CLOSE_DISABLED = 101, which
is why it cannot just reuse the other enum. Member names are prefixed because
MQL5 enum members share ONE flat namespace - a bare PCT_25 in the second enum
would silently resolve to the first one's, warning only. Values are unchanged,
so existing .set files keep their settings. Both call sites now cast
explicitly at the CExpertSignal boundary rather than leaning on an implicit
enum-to-int conversion that only warns.
ARROWS. 2026-08-19 replaced the low/high arrows WITH trigger-price lines; that
was a swap where it should have been an addition, and it cost the zoomed-out
view. A mark is now both objects: the line is the precise entry/exit level,
the arrow off the candle's extreme is the finder that says there is something
here to zoom into. The arrow's name is the line's plus a suffix, so it stays
inside SIG_ARROW_PREFIX and every prefix-scoped purge already reaches it.
The two type-filtered sweeps had to widen or they would clear one half and
leave the other: the Hide/Show visibility loop and the pre-rescan scoped
delete both walked OBJ_TREND only. Both are typed-blind and prefix-scoped now
- the same widening this file's 2026-08-09 note describes, for the same reason
it gives. Deletes go through one WarriorDeleteSignalMark() so an arrow cannot
outlive the line it belongs to, and the sidecar deliberately still records one
row per mark off the line (the half carrying the price), with the restore
redrawing the pair.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-20 13:50:33 -04:00
|
|
|
//--- Signal_ThresholdClose's scale. Same rungs as PERCENTAGE_PRESETS plus the 101 that disables the
|
|
|
|
|
//--- vote exit by arithmetic (a weighted mean of 0-100 weights cannot reach it), which is why this
|
|
|
|
|
//--- cannot simply reuse that enum. Names are prefixed because MQL5 enum members share ONE FLAT
|
|
|
|
|
//--- namespace across the whole build - a bare PCT_25 here would collide with the one above and
|
|
|
|
|
//--- resolve to whichever enum was declared first, with only a warning (see TRADING_DIRECTION).
|
|
|
|
|
enum SIGNAL_CLOSE_PRESETS
|
|
|
|
|
{
|
|
|
|
|
CLOSE_PCT_5 = 5, // 5%
|
|
|
|
|
CLOSE_PCT_10 = 10, // 10%
|
|
|
|
|
CLOSE_PCT_15 = 15, // 15%
|
|
|
|
|
CLOSE_PCT_20 = 20, // 20%
|
|
|
|
|
CLOSE_PCT_25 = 25, // 25%
|
|
|
|
|
CLOSE_PCT_30 = 30, // 30%
|
|
|
|
|
CLOSE_PCT_35 = 35, // 35%
|
|
|
|
|
CLOSE_PCT_40 = 40, // 40%
|
|
|
|
|
CLOSE_PCT_45 = 45, // 45%
|
|
|
|
|
CLOSE_PCT_50 = 50, // 50%
|
|
|
|
|
CLOSE_PCT_60 = 60, // 60%
|
|
|
|
|
CLOSE_PCT_70 = 70, // 70%
|
|
|
|
|
CLOSE_PCT_80 = 80, // 80%
|
|
|
|
|
CLOSE_PCT_90 = 90, // 90%
|
|
|
|
|
CLOSE_PCT_100 = 100, // 100%
|
|
|
|
|
CLOSE_DISABLED = 101, // Disabled (hold to the barrier)
|
|
|
|
|
};
|
2026-07-23 19:36:34 -04:00
|
|
|
//--- Strength (tau) of the post-hoc logit adjustment / prior correction applied to the AI's 3-class
|
|
|
|
|
//--- decision at inference (see AdjustedSignalFromSoftmax in ExpertSignalAIBase.mqh). The network is
|
|
|
|
|
//--- trained on class-balance-oversampled data, so its raw softmax over-calls the rare Buy/Sell classes;
|
|
|
|
|
//--- re-weighting each class by its measured true base rate (prior^tau) pulls the decision back toward the
|
|
|
|
|
//--- real distribution. 0 = Off (raw argmax, may over-call), 100 = full Bayesian calibration to the true
|
|
|
|
|
//--- base rate. Stored as a percent; divided by 100 to get tau.
|
|
|
|
|
enum LOGIT_PRIOR_STRENGTH_PRESETS
|
|
|
|
|
{
|
|
|
|
|
LOGIT_PRIOR_OFF = 0, // Off (raw argmax - may over-call Buy/Sell)
|
|
|
|
|
LOGIT_PRIOR_25 = 25, // 25% (light correction)
|
|
|
|
|
LOGIT_PRIOR_50 = 50, // 50% (moderate)
|
|
|
|
|
LOGIT_PRIOR_75 = 75, // 75% (strong)
|
|
|
|
|
LOGIT_PRIOR_100 = 100, // 100% (full calibration to true base rate)
|
|
|
|
|
};
|
refactor(ai): derive the first dense layer's width instead of asking for it
InitialNeurons was an input whose only defensible value depends on two
things the user cannot see when picking from a dropdown: how wide the input
vector ended up after feature selection, and how much in-sample data the
study period actually yields. Left to a hand-picked constant it was badly
wrong - 500 units against a 420-wide input is 210,500 weights, 72% of a
292,583-weight model, against ~36,500 training bars of which only ~2,236
are directional. That is 6.6 weights per training bar, and it EXPANDS a set
of highly correlated inputs rather than compressing them.
The symptom was already in the logs and had been read as a depth problem:
the shallowest topology consistently beat the deepest (perceptron 52.7%
balanced, hybrid 41.3%). Over-parameterization predicts that ordering just
as well as covariate shift does, and only one of the two had been addressed.
ComputeFirstLayerWidth() budgets roughly one first-layer weight per
in-sample bar. Measured across the configurations in use:
M15 10y -> 256 units, 129,071 weights, 0.73 per bar
H1 10y -> 64 units, 28,727 weights, 0.65 per bar
H4 10y -> 16 units, 7,559 weights, 0.68 per bar
Two design points that matter:
- It estimates in-sample bars from the STUDY PERIOD and timeframe, not
from Bars(). What is downloaded grows over a terminal's lifetime, and a
topology that widened as history filled in would re-key its own weights
file and discard a trained model.
- The result is snapped down to a coarse power-of-two ladder, so the
estimate would have to be wrong by ~2x to change the answer.
Every field it reads is already part of the weights-filename fingerprint,
so the derived value needs no fingerprint entry of its own. The public
setter is removed - it could only have been called after construction, and
would either be ignored or silently re-key the model mid-run.
Where the data cannot support even the floor (D1 over 10 years is under
2,000 bars) it now says so and names the fixes, rather than quietly
training a model with more weights than examples.
The DB config fingerprint drops the term too, which re-keys existing
pattern databases once - correct, since a model an order of magnitude
smaller should not inherit the old one's win-rate history.
Compiles 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 13:01:16 -04:00
|
|
|
//--- FIRST_LAYER_NEURONS removed 2026-07-29. The first dense layer dominates the parameter count -
|
|
|
|
|
//--- it is (inputWidth+1) x width - so its only defensible value is a function of the input width and
|
|
|
|
|
//--- the amount of in-sample data, neither of which the user can see when picking from a dropdown. It
|
|
|
|
|
//--- is now derived: see CExpertSignalAIBase::ComputeFirstLayerWidth().
|
feat(ensemble): per-NN inputs replace the preset selector - the meta head becomes the vote's gate
User design (2026-08-19): 'remove the enum menu that selects neural networks... individual
inputs for every NN just like classic signals... the META NN should be integrated into the
voting decision pipeline when enabled... as a bonus meta labelling is applied to enabled NNs.'
- AI_CHOICE is GONE (tombstoned per the stale-.set doctrine). Use_MLP/Use_CONV/Use_LSTM/
Use_CONVLSTM are ordinary bools like the classic votes; the ensemble arithmetic adapts to
any subset because the consensus divisor is the enabled capable weight. Two or more
enabled = ensemble (|ENS1 token + joint gate, exactly the old AI_HYBRID fingerprints, so
existing weight files keep loading); one = the old solo preset; none = classic-only.
- Use_MetaLabeling un-couples META from the direction NNs (the old selector made them
mutually exclusive). S3 ships: CSignalMETA::LiveMetaGate scores each vote-cleared entry
(shared window at bar 1 + proposal descriptor: side, net vote, live geometry, spread/ATR;
pattern one-hot ZEROED - ranking, not calibrated probability, documented in the body) and
vetoes below the cost-adjusted break-even. Entries only; fail-open everywhere, loudly.
- COEXISTENCE HAZARDS closed: VoteCapableWeight()=0 and ProspectiveVote()=false for the
meta target - solo-only until today, a trained META would otherwise sit in the consensus
divisor as a permanent abstainer and shrink every vote by its module weight.
- CERTIFIED == TRADED: the ensemble era verdict replays the identical veto through the same
g_warriorMetaGate pointer over its OOS fired bars (bar re-resolved from the row's own
time; fail-open counted as fires and reported: 'metaGate: N approved, M vetoed, K
unscored'). The overlay deliberately does NOT replay it (veto-filter-in-replay class,
calendar-cliff precedent) - documented at the sweep site. Solo charts' own gate does not
model the veto - the standing solo-gate caveat, documented at the input.
- DB continuity: the pattern/journal DB fingerprint's first slot was (int)AIType;
DbLegacyAiSlot() maps every legacy-expressible config to its OLD value (new 2-3 member
subsets get 100+bitmask, outside the legacy range) so no existing database re-keys.
filterID becomes the enabled roster via one EnabledNNSummary().
- HUD: the meta line shows the gate (armed/(trn), last P vs BE, ok/veto tally); the
armed/disarmed announcement fires on state change via one latch (MetaGateArmedNow), not
only when an entry happens to be proposed.
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:01:02 -04:00
|
|
|
//--- Architecture-aware dense-topology presets were then folded into the (since-removed) AI_CHOICE
|
|
|
|
|
//--- selector; today the front-end choice is the per-NN Use_* toggles and the dense taper is fully
|
|
|
|
|
//--- derived - see ComputeHiddenLayerCount.
|
2026-07-22 22:51:04 -04:00
|
|
|
//--- LSTM's own recurrent hidden-unit count - previously silently piggybacked on HiddenLayersCount
|
|
|
|
|
//--- (an unrelated dense-taper-depth setting), which meant it could never be tuned independently and
|
|
|
|
|
//--- defaulted to a value (4) nobody actually chose on purpose. Decoupled into its own input.
|
|
|
|
|
enum LSTM_HIDDEN_SIZE_PRESET
|
|
|
|
|
{
|
|
|
|
|
LSTM_HIDDEN_8 = 8, // 8 Units
|
|
|
|
|
LSTM_HIDDEN_16 = 16, // 16 Units
|
|
|
|
|
LSTM_HIDDEN_32 = 32, // 32 Units
|
|
|
|
|
LSTM_HIDDEN_64 = 64, // 64 Units
|
|
|
|
|
LSTM_HIDDEN_128 = 128, // 128 Units
|
|
|
|
|
};
|
|
|
|
|
//--- CONV's own output-filter count for its convolutional layer - previously silently piggybacked on
|
|
|
|
|
//--- HiddenLayersCount too (same bug class as LstmHiddenSize above), defaulting to a bottleneck of 4
|
|
|
|
|
//--- filters/bar. Decoupled into its own input.
|
|
|
|
|
enum CONV_FILTER_COUNT_PRESET
|
|
|
|
|
{
|
|
|
|
|
CONV_FILTERS_8 = 8, // 8 Filters
|
|
|
|
|
CONV_FILTERS_16 = 16, // 16 Filters
|
|
|
|
|
CONV_FILTERS_32 = 32, // 32 Filters
|
|
|
|
|
CONV_FILTERS_64 = 64, // 64 Filters
|
|
|
|
|
CONV_FILTERS_128 = 128, // 128 Filters
|
|
|
|
|
};
|
2026-07-27 22:08:55 -04:00
|
|
|
//--- Shared pooling shape for the Conv front-end used by both CONV and HYBRID. Keeping this
|
|
|
|
|
//--- separate from ConvFilterCount lets the filter-bank width and the downsampling span be tuned
|
|
|
|
|
//--- independently, instead of smuggling one into the other.
|
fix(ai): drop the conv pooling stage - it reduced across filters, not time
FeedForwardConv emits POSITION-MAJOR output, matrix_o[out + window_out * i],
so one bar's window_out filter responses are contiguous and consecutive bars
sit window_out apart. Both pooling implementations (FeedForwardProof and
CPU_FeedForwardProof) slide FLAT over that buffer - pos = i * step, reducing
`window` CONSECUTIVE elements. On a position-major layout those neighbours
are different FILTERS of the same bar, never one filter across time.
At the shipped 3/2 the pool computed max(bar0_f0, bar0_f1, bar0_f2), then
max(bar0_f2, bar0_f3, bar0_f4), with every 8th window straddling a bar
boundary. So it collapsed unrelated feature detectors into whichever fired
hardest, passed gradient to that winner only, and halved the feature map
while doing it - all below every learnable layer, where nothing above can
recover it. The removed inputs' own labels ("3 Bars") show time-axis pooling
was the intent throughout.
Measured cost: CONV sat pinned at ~40% balanced accuracy for 510 eras with
Sell recall 0%, while plain MLPs on the same data reached 57-61%. HYBRID,
which also carried this stage, came second-worst of the batch-norm group.
Not fixable in the topology: pooling one filter across time needs a stride
of window_out BETWEEN samples within a window, which a consecutive-window
kernel cannot express at any window/step. That needs a stride-aware kernel
in Network.cl + WarriorCPU.cpp + WarriorDML.cpp and a DLL rebuild, and is
only worth doing if a conv front-end earns its place without downsampling
first - with 20 sliding positions there is little to gain by halving them.
ConvPoolWindow/ConvPoolStep and their enums are removed with it, along with
the |CP: fingerprint term added earlier today.
Both builds compile 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-29 19:28:44 -04:00
|
|
|
//--- CONV_POOL_WINDOW_PRESET / CONV_POOL_STEP_PRESET removed 2026-07-29 along with the pooling
|
|
|
|
|
//--- stage itself - their "N Bars" labels described time-axis pooling the implementation could
|
|
|
|
|
//--- never perform. See AddConvStage() in Expert\ExpertSignalAIBase.mqh.
|
2026-07-13 03:23:39 -04:00
|
|
|
|
|
|
|
|
enum MIN_NEURONS_COUNT
|
|
|
|
|
{
|
|
|
|
|
MIN_NEURONS_10 = 10, // Min. 10 Neurons per layer
|
|
|
|
|
MIN_NEURONS_20 = 20, // Min. 20 Neurons per layer
|
|
|
|
|
MIN_NEURONS_30 = 30, // Min. 30 Neurons per layer
|
|
|
|
|
MIN_NEURONS_40 = 40, // Min. 40 Neurons per layer
|
|
|
|
|
MIN_NEURONS_50 = 50, // Min. 50 Neurons per layer
|
|
|
|
|
};
|
2026-07-16 00:56:33 -04:00
|
|
|
// Value IS the reduction percentage applied per hidden layer (retention = 100-value), consumed
|
|
|
|
|
// via BuildFreshTopology()'s n = n*((100-value)*0.01) taper - e.g. RF_70 keeps 30% of the previous
|
|
|
|
|
// layer's neurons, i.e. a genuine 70% reduction per layer, matching the label at face value.
|
2026-07-13 03:23:39 -04:00
|
|
|
enum NEURONS_REDUCTION_FACTOR
|
|
|
|
|
{
|
2026-07-16 00:56:33 -04:00
|
|
|
RF_10 = 10, // 10 % Neurons Reduction Per Layer
|
|
|
|
|
RF_20 = 20, // 20 % Neurons Reduction Per Layer
|
|
|
|
|
RF_30 = 30, // 30 % Neurons Reduction Per Layer
|
|
|
|
|
RF_40 = 40, // 40 % Neurons Reduction Per Layer
|
2026-07-13 03:23:39 -04:00
|
|
|
RF_50 = 50, // 50 % Neurons Reduction Per Layer
|
2026-07-16 00:56:33 -04:00
|
|
|
RF_60 = 60, // 60 % Neurons Reduction Per Layer
|
|
|
|
|
RF_70 = 70, // 70 % Neurons Reduction Per Layer
|
|
|
|
|
RF_80 = 80, // 80 % Neurons Reduction Per Layer
|
|
|
|
|
RF_90 = 90, // 90 % Neurons Reduction Per Layer
|
2026-07-13 03:23:39 -04:00
|
|
|
};
|
|
|
|
|
enum OUTPUT_NEURONS_COUNT
|
|
|
|
|
{
|
|
|
|
|
OUTPUT_REGRESSION = 1, // Regression Algorithm
|
|
|
|
|
OUTPUT_CLASSIFICATION = 3, // Classification Algorithm
|
|
|
|
|
};
|
feat(ensemble): per-NN inputs replace the preset selector - the meta head becomes the vote's gate
User design (2026-08-19): 'remove the enum menu that selects neural networks... individual
inputs for every NN just like classic signals... the META NN should be integrated into the
voting decision pipeline when enabled... as a bonus meta labelling is applied to enabled NNs.'
- AI_CHOICE is GONE (tombstoned per the stale-.set doctrine). Use_MLP/Use_CONV/Use_LSTM/
Use_CONVLSTM are ordinary bools like the classic votes; the ensemble arithmetic adapts to
any subset because the consensus divisor is the enabled capable weight. Two or more
enabled = ensemble (|ENS1 token + joint gate, exactly the old AI_HYBRID fingerprints, so
existing weight files keep loading); one = the old solo preset; none = classic-only.
- Use_MetaLabeling un-couples META from the direction NNs (the old selector made them
mutually exclusive). S3 ships: CSignalMETA::LiveMetaGate scores each vote-cleared entry
(shared window at bar 1 + proposal descriptor: side, net vote, live geometry, spread/ATR;
pattern one-hot ZEROED - ranking, not calibrated probability, documented in the body) and
vetoes below the cost-adjusted break-even. Entries only; fail-open everywhere, loudly.
- COEXISTENCE HAZARDS closed: VoteCapableWeight()=0 and ProspectiveVote()=false for the
meta target - solo-only until today, a trained META would otherwise sit in the consensus
divisor as a permanent abstainer and shrink every vote by its module weight.
- CERTIFIED == TRADED: the ensemble era verdict replays the identical veto through the same
g_warriorMetaGate pointer over its OOS fired bars (bar re-resolved from the row's own
time; fail-open counted as fires and reported: 'metaGate: N approved, M vetoed, K
unscored'). The overlay deliberately does NOT replay it (veto-filter-in-replay class,
calendar-cliff precedent) - documented at the sweep site. Solo charts' own gate does not
model the veto - the standing solo-gate caveat, documented at the input.
- DB continuity: the pattern/journal DB fingerprint's first slot was (int)AIType;
DbLegacyAiSlot() maps every legacy-expressible config to its OLD value (new 2-3 member
subsets get 100+bitmask, outside the legacy range) so no existing database re-keys.
filterID becomes the enabled roster via one EnabledNNSummary().
- HUD: the meta line shows the gate (armed/(trn), last P vs BE, ok/veto tally); the
armed/disarmed announcement fires on state change via one latch (MetaGateArmedNow), not
only when an entry happens to be proposed.
NOT COMPILED - user compiles in MetaEditor.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 13:01:02 -04:00
|
|
|
//--- AI_CHOICE REMOVED 2026-08-19 (user request: "remove the enum menu that selects neural networks,
|
|
|
|
|
//--- add individual inputs for every NN just like classic signals"). The preset selector could only
|
|
|
|
|
//--- express solo-or-all (no 2-3 member subsets) and made the META head mutually exclusive with the
|
|
|
|
|
//--- direction NNs. Replaced by the per-NN bools in Variables\Inputs.mqh (Use_MLP/Use_CONV/Use_LSTM/
|
|
|
|
|
//--- Use_CONVLSTM) plus Use_MetaLabeling; the ensemble machinery keys off "two or more direction NNs
|
|
|
|
|
//--- enabled" (ConfigureAISignal), which reproduces the old AI_HYBRID fingerprints exactly, and the
|
|
|
|
|
//--- pattern-DB filename keeps its first slot via DbLegacyAiSlot() (Warrior_EA.mq5) so no existing
|
|
|
|
|
//--- database re-keys. Deleted rather than left dangling, same doctrine as RISK_LIMIT_PCT_PRESET at
|
|
|
|
|
//--- the bottom of this file: a live enum with no input behind it is exactly the stale-.set trap
|
|
|
|
|
//--- shape. Stale "AIType=..." lines in saved .set files are ignored by name, harmlessly.
|
|
|
|
|
//--- (Historical: value 4 was renamed AI_CONVLSTM 2026-08-15; State\HYBRID\ folder names were kept
|
|
|
|
|
//--- across that rename and remain the CONVLSTM instance's identity - see CSignalHYBRID.)
|
|
|
|
|
//--- What the direction models (MLP/CONV/LSTM/CONVLSTM) train toward. Ignored by the META head,
|
|
|
|
|
//--- whose candidate-quality target is baked into its own class. Part of the model fingerprint (|TGT:FRA1),
|
2026-08-15 04:44:10 -04:00
|
|
|
//--- so switching it trains a separate model rather than silently relabelling an existing one.
|
|
|
|
|
enum TRAINING_TARGET
|
|
|
|
|
{
|
|
|
|
|
TARGET_BARRIER = 0, // Triple barrier (does a trade here reach target before stop)
|
|
|
|
|
TARGET_FRACTAL = 1, // Next fractal direction (which way is the next confirmed swing extreme)
|
|
|
|
|
};
|
2026-07-13 03:23:39 -04:00
|
|
|
// Confidence used to scale SL/TP, gate early AI exits, and (Intelligent MM) scale lot size.
|
|
|
|
|
// AI confidence comes from the signal filter's live prediction (0..1); DB confidence comes
|
|
|
|
|
// from the historical time-based win rate of the currently traded patterns (0..1). Blended
|
|
|
|
|
// averages both, so a pattern is only sized up when both the model and its track record agree.
|
|
|
|
|
enum CONFIDENCE_SOURCE
|
|
|
|
|
{
|
|
|
|
|
CONF_AI = 0, // AI signal confidence only
|
|
|
|
|
CONF_DB = 1, // Database win-rate confidence only
|
|
|
|
|
CONF_BLENDED = 2, // Average of AI and database confidence
|
|
|
|
|
};
|
2026-07-16 00:56:33 -04:00
|
|
|
// How many bars to wait, after a candidate ZigZag reversal bar, before trusting the real ADZigZag
|
|
|
|
|
// indicator's verdict on it as a training label - see CExpertSignalAIBase's m_swingConfirmationBars
|
|
|
|
|
// declaration comment. A ZigZag's most recent 1-3 legs can still repaint as new bars arrive, so this
|
|
|
|
|
// must be generous enough to let a leg fully settle (bumped from the old fractal-based system's
|
|
|
|
|
// default of 20 to 100 for exactly that reason). A value of 0 is clamped up to a 1-bar minimum
|
|
|
|
|
// internally, never used to mean "no delay".
|
|
|
|
|
enum SWING_CONFIRMATION_PRESET
|
|
|
|
|
{
|
|
|
|
|
SC_10 = 10, // 10 Bars
|
|
|
|
|
SC_20 = 20, // 20 Bars
|
|
|
|
|
SC_30 = 30, // 30 Bars
|
|
|
|
|
SC_50 = 50, // 50 Bars
|
|
|
|
|
SC_100 = 100, // 100 Bars
|
|
|
|
|
SC_200 = 200, // 200 Bars
|
|
|
|
|
};
|
|
|
|
|
enum MAX_ERAS_PRESET
|
|
|
|
|
{
|
|
|
|
|
ME_100 = 100, // 100 Eras
|
|
|
|
|
ME_200 = 200, // 200 Eras
|
|
|
|
|
ME_300 = 300, // 300 Eras
|
|
|
|
|
ME_500 = 500, // 500 Eras
|
|
|
|
|
ME_1000 = 1000, // 1000 Eras
|
2026-08-16 23:52:22 -04:00
|
|
|
ME_2000 = 2000, // 2000 Eras
|
|
|
|
|
ME_3000 = 3000, // 3000 Eras
|
|
|
|
|
ME_5000 = 5000, // 5000 Eras
|
|
|
|
|
ME_10000 = 10000, // 10000 Eras
|
2026-07-16 00:56:33 -04:00
|
|
|
};
|
2026-07-13 03:23:39 -04:00
|
|
|
//--- percentage of the study period held back as out-of-sample data never trained on;
|
|
|
|
|
//--- value is the OOS share, in-sample share is the remainder (e.g. OOS_30 -> 70% IS / 30% OOS)
|
|
|
|
|
enum OOS_SPLIT_PRESET
|
|
|
|
|
{
|
|
|
|
|
OOS_10 = 10, // 90% IS / 10% OOS
|
|
|
|
|
OOS_20 = 20, // 80% IS / 20% OOS
|
|
|
|
|
OOS_30 = 30, // 70% IS / 30% OOS
|
|
|
|
|
OOS_40 = 40, // 60% IS / 40% OOS
|
|
|
|
|
OOS_50 = 50, // 50% IS / 50% OOS
|
|
|
|
|
};
|
2026-08-02 12:25:20 -04:00
|
|
|
//--- RISK_LIMIT_PCT_PRESET REMOVED 2026-08-02. It backed MaxDailyLossPct/MaxDrawdownPct as a dropdown
|
|
|
|
|
//--- of eight fixed percentages, which no funded-account programme is obliged to match - 4.5% or 3.75%
|
|
|
|
|
//--- were unreachable. Both inputs are now free-entry doubles (Variables\Inputs.mqh) validated at init.
|
|
|
|
|
//--- Note for anyone reinstating an enum input here: MT5 does NOT validate a saved enum value against
|
|
|
|
|
//--- the current enum, so a .set file holding a deleted member loads as a silent out-of-range int - the
|
|
|
|
|
//--- failure mode that trained four topologies on the wrong barrier (project memory: stale enum wrong
|
|
|
|
|
//--- target). Changing these two to doubles removes that exposure rather than renaming it.
|
2026-07-18 17:29:38 -04:00
|
|
|
//+------------------------------------------------------------------+
|