Vizion-Trading-EA/AISignalConfirmation.mqh
SahrJohn 222a2e2408 Fix MQL5 compilation errors: StringToUpper and MqlCalendarEvent.currency
- Fix StringToUpper() used as return-value function in Utilities.mqh,
  NewsEngine.mqh, OpenAI.mqh, AISignalConfirmation.mqh (MQL5 requires
  in-place usage: copy string first, then call StringToUpper on copy)
- Fix NewsEngine.mqh: MqlCalendarEvent has no .currency field; replaced
  with CalendarCountryById() lookup using MqlCalendarCountry.currency

Result: 0 errors, 0 warnings

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-17 23:21:13 -06:00

37 lines
781 B
MQL5

#ifndef AI_SIGNAL_CONFIRMATION_MQH
#define AI_SIGNAL_CONFIRMATION_MQH
bool AIApproveTrade(const bool is_buy, const string setup_name, double &size_multiplier)
{
// Mandatory live AI gate: fail closed.
if(!AI_Initialized)
return false;
string ai_response = ValidateTradeWithAI(setup_name, is_buy);
string ai_upper = ai_response;
StringToUpper(ai_upper);
if(StringFind(ai_upper, "YES") >= 0)
{
AI_Validation_Accepts++;
return true;
}
if(StringFind(ai_upper, "NO") >= 0)
{
AI_Validation_Rejects++;
return false;
}
if(StringFind(ai_upper, "MAYBE") >= 0)
{
size_multiplier *= 0.5;
return true;
}
// Unknown = reject to keep AI mandatory.
AI_Validation_Rejects++;
return false;
}
#endif