2026-07-13 03:23:39 -04:00
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Warrior_EA |
|
|
|
|
|
//| AnimateDread |
|
|
|
|
|
//| |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
// Money management classes (CExpertMoney) are invoked by the standard library's
|
|
|
|
|
// CExpert with a fixed (price, sl) signature - they have no pointer back to the
|
|
|
|
|
// signal filter that computed those levels. CExpertSignalCustom::OpenParams()
|
|
|
|
|
// refreshes these globals right before Money.CheckOpenLong/Short() is called for
|
|
|
|
|
// the same trade, so Money classes can read a same-tick confidence value without
|
|
|
|
|
// requiring an intrusive change to the wizard framework's call chain.
|
|
|
|
|
double g_AISignedConfidence = 0.0; // -1..1, sign = direction, magnitude = AI confidence; 0 if no AI filter
|
|
|
|
|
double g_DBConfidence = 0.0; // 0..1, historical time-based win rate of the active pattern set
|
|
|
|
|
// source takes CONFIDENCE_SOURCE's underlying int values (0=CONF_AI, 1=CONF_DB, 2=CONF_BLENDED).
|
|
|
|
|
// Declared as int rather than the enum type so this header has no dependency on the include
|
|
|
|
|
// order of Enumerations\InputEnums.mqh (this file is pulled in from class headers that are
|
|
|
|
|
// included before Inputs.mqh in Warrior_EA.mq5).
|
2026-07-18 17:39:58 -04:00
|
|
|
// reward:risk ratio of the specific trade OpenParams() just sized (b in the Kelly-criterion
|
|
|
|
|
// formula CMoneyIntelligent::AdjustRiskAmount() uses) - refreshed on the same same-tick
|
|
|
|
|
// contract as the two confidence globals above; always > 0 when populated, since OpenParams()
|
|
|
|
|
// already rejects any setup below Min_Risk_Reward_Ratio before Money is ever consulted.
|
|
|
|
|
double g_TradeRewardRiskRatio = 0.0;
|
2026-07-13 03:23:39 -04:00
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
//| Combine AI/DB confidence into a single 0..1 magnitude |
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
|
|
|
double CombinedConfidence(int source)
|
|
|
|
|
{
|
|
|
|
|
double aiMag = MathMax(0.0, MathMin(MathAbs(g_AISignedConfidence), 1.0));
|
|
|
|
|
double dbMag = MathMax(0.0, MathMin(g_DBConfidence, 1.0));
|
|
|
|
|
switch(source)
|
|
|
|
|
{
|
|
|
|
|
case 1: // CONF_DB
|
|
|
|
|
return dbMag;
|
|
|
|
|
case 2: // CONF_BLENDED
|
|
|
|
|
return (aiMag + dbMag) / 2.0;
|
|
|
|
|
default: // CONF_AI
|
|
|
|
|
return aiMag;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//+------------------------------------------------------------------+
|