2026-02-15 05:13:55 +00:00
|
|
|
#ifndef AI_SIGNAL_CONFIRMATION_MQH
|
|
|
|
|
#define AI_SIGNAL_CONFIRMATION_MQH
|
|
|
|
|
|
feat: replace OpenAI with n8n AI Gateway + session + watchlist
- Remove OpenAI.mqh entirely (no direct API calls)
- Add AIGateway.mqh: unified gateway → n8n → OpenRouter → Claude
- advisory mode: EA never fails to start (gateway down = MAYBE 0.5x)
- mandatory mode: blocks trades if gateway unreachable
- actions: validate_trade, get_briefing, get_session, get_news_bias,
report_trade, watchlist_status, ping
- includes bid/est_sl/est_tp in validate_trade payload
- Add AISession.mqh: AMD session detection (Asia/London/NY/Interbank)
with corner chart labels showing session phase + GW status
- InputParams.mqh: AI_Mode, AI_Gateway_URL, briefing TF flags,
AI_Session_Draw, Use_Watchlist_Gate
- GlobalVariables.mqh: gateway state, per-TF briefing cache,
session + news headlines globals
- MasterAICoordinator.mqh: wired to AIGateway (SetUseOpenAI shim kept)
- NewsEngine.mqh: merges live AI news bias from gateway
- AISignalConfirmation.mqh: delegates to AIValidateTrade()
- AILabels.mqh: GW status (color-coded), validation stats, per-TF briefs
- ChartLabels.mqh: session label integration
- profitgtx.mq5 v7.00: OnInit init gateway + session, OnTimer multi-TF
briefing refresh, OnTradeTransaction fire-and-forget trade report
- Recompile: 0 errors, 0 warnings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 06:34:27 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
// AISignalConfirmation.mqh — Trade gate using AI Gateway
|
|
|
|
|
// advisory: allow at 0.5x size if gateway is down
|
|
|
|
|
// mandatory: block trade if gateway is down or returns NO
|
|
|
|
|
// off: always allow (no AI gate)
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
2026-03-31 02:57:33 +00:00
|
|
|
bool AIApproveTrade(const bool is_buy,
|
|
|
|
|
const string setup_name,
|
|
|
|
|
const double intended_lots,
|
|
|
|
|
const double spread_points,
|
|
|
|
|
const double risk_amount,
|
|
|
|
|
const double margin_required,
|
|
|
|
|
const double free_margin,
|
|
|
|
|
const string session_phase,
|
|
|
|
|
double &size_multiplier)
|
2026-02-15 05:13:55 +00:00
|
|
|
{
|
feat: replace OpenAI with n8n AI Gateway + session + watchlist
- Remove OpenAI.mqh entirely (no direct API calls)
- Add AIGateway.mqh: unified gateway → n8n → OpenRouter → Claude
- advisory mode: EA never fails to start (gateway down = MAYBE 0.5x)
- mandatory mode: blocks trades if gateway unreachable
- actions: validate_trade, get_briefing, get_session, get_news_bias,
report_trade, watchlist_status, ping
- includes bid/est_sl/est_tp in validate_trade payload
- Add AISession.mqh: AMD session detection (Asia/London/NY/Interbank)
with corner chart labels showing session phase + GW status
- InputParams.mqh: AI_Mode, AI_Gateway_URL, briefing TF flags,
AI_Session_Draw, Use_Watchlist_Gate
- GlobalVariables.mqh: gateway state, per-TF briefing cache,
session + news headlines globals
- MasterAICoordinator.mqh: wired to AIGateway (SetUseOpenAI shim kept)
- NewsEngine.mqh: merges live AI news bias from gateway
- AISignalConfirmation.mqh: delegates to AIValidateTrade()
- AILabels.mqh: GW status (color-coded), validation stats, per-TF briefs
- ChartLabels.mqh: session label integration
- profitgtx.mq5 v7.00: OnInit init gateway + session, OnTimer multi-TF
briefing refresh, OnTradeTransaction fire-and-forget trade report
- Recompile: 0 errors, 0 warnings
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-20 06:34:27 +00:00
|
|
|
if(!AI_Validate_Trades || AI_Mode == "off")
|
2026-02-15 05:13:55 +00:00
|
|
|
return true;
|
|
|
|
|
|
2026-03-31 02:57:33 +00:00
|
|
|
return AIValidateTrade(setup_name, is_buy, intended_lots, spread_points, risk_amount, margin_required, free_margin, session_phase, size_multiplier);
|
2026-02-15 05:13:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|