Warrior_EA/Enumerations
Repository files (latest commit first)
Filename Latest commit message Latest commit date
AnimateDread 17270ab308 feat(trade): two books per symbol, and delete the vote exit
Allow_Hedging (default ON, live only on a RETAIL_HEDGING account) gives the EA
an independent long book and short book on its symbol: at most one long and at
most one short, each opened on its own side's vote and each held to its own
barrier. On a netting account, or with the input off, the original
single-position path runs bit-for-bit unchanged and init says which one is live.

WHY THIS INSTEAD OF A VOTE EXIT. The deploy gate certifies
P(label agrees | vote fired) and the label runs to the barrier, so closing early
on a reversal makes the realised outcome stop being the labelled one - the
certified precision no longer describes what is traded. Opening the other side
acts on the new signal and leaves the old position's certification intact, and
costs no more than reversing: both pay the new side's spread, the difference is
only that the existing position runs on to a barrier already measured as
positive-expectancy. So Signal_ThresholdClose is DELETED rather than tuned,
along with its SIGNAL_CLOSE_PRESETS enum; the threshold is pinned to an
arithmetically unreachable 101 (the stock default of 100 is reachable by a
weighted mean of values capped at 100).

Note the two books can never both fill from one signal: CheckOpenLong and
CheckOpenShort test opposite signs of the same m_direction, so at most one clears
per tick. A hedge only forms when a LATER opposite vote fires - which is what
keeps it from being a guaranteed-loss wash pair.

The mechanism is a SelectPosition() override keyed on the active book's magic;
every inherited close/trail path then operates on that book untouched. The long
book keeps Expert_MagicNumber, so no existing position, journal row or
risk-budget state file is re-addressed. Short book is +1.

Four ownership filters had to widen from "== m_magic" to WarriorOwnsMagic(),
or the short book would have been invisible to the code that must reach it:
the scheduled close-all (positions and orders), the risk budget's emergency
flatten, and the journal's MAE/MFE walk. WarriorOwnsMagic() is deliberately NOT
gated on Allow_Hedging - turning the input off while a short-book position is
open would otherwise orphan it with nothing left to close it.

Risk sizing needed no change: CapRiskAmount already subtracts OpenRiskAtStops(),
which counts every position regardless of magic, so the second book is sized
inside what the first one left. Conservative for a hedged pair, which cannot
lose both stops - the safe direction.

Retrain-neutral: neither input is in BuildModelFingerprint() or
ComputeDbConfigFingerprint(). Compiled clean; NOT yet run.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 09:20:35 -04:00
..
GlobalEnums.mqh refactor(comments): box headers to stdlib length 2026-08-22 00:30:14 -04:00
InputEnums.mqh feat(trade): two books per symbol, and delete the vote exit 2026-08-26 09:20:35 -04:00
README.md feat: Enhance README and documentation for Warrior_EA project 2026-04-20 19:28:34 -04:00

Enumerations Documentation

GlobalEnums.mqh

Defines the ENUM_SIGNAL enumeration for trading signal states:

  • Buy: Indicates a buy signal.
  • Sell: Indicates a sell signal.
  • Neutral: Indicates a neutral/no-action signal.
  • Undefine: Indicates an undefined or uninitialized state.

InputEnums.mqh

Defines a large set of enumerations for configuration and input parameters used throughout the EA. These include:

  • Custom menu and property enums for UI/configuration.
  • Period presets (e.g., 5, 10, 14, 20, 30, 50, 100, 200) for indicator calculations.
  • Training years presets for ML/AI training window selection.
  • ATR multipliers for volatility-based calculations.
  • Threshold presets for signal/trigger sensitivity.
  • Risk/reward ratio presets for money management.
  • Bars expiration settings for trade/session logic.
  • Entry multipliers for order sizing.
  • Trailing strategy types (none, ATR-based, SAR, MA, etc.).
  • Money management strategies (fixed risk, intelligent, fixed lot, etc.).
  • Day-of-week and session enums for time-based logic.
  • ITF (Intraday Time Filter) settings.
  • Hourly session presets (H1-H23) for time filtering.

Purpose: These enumerations provide a strongly-typed, maintainable way to configure and control the EA's behavior, supporting both traditional and AI/ML-driven logic. They enable dynamic feature selection, risk management, and strategy configuration, and are essential for modular, testable code.

Modernization Note:

  • Enumerations should be referenced in configuration UIs and parameter files to enable dynamic, user-driven feature pipelines.
  • Consider extending enums to support new AI/ML features and dynamic input selection as the EA evolves.