Vizion-Trading-EA/VZ_TogglePause.mq5
SahrJohn SahrJohn 526860b9cd EA: sync live build (Jul-Nov 2026) — trade report direction/setup fix, VZ indicators, risk modules
- AIGateway/profitgtx: report_trade takes direction and setup from the position's
  opening deal ("dir_src":"entry"); the closing deal inverted every direction and
  restarts lost the setup (99% "auto")
- add MATheory, RiskGuards, RiskSizing, TradePolicy (setup blocklist, strict AI gate)
- add VZ_Core + VZ_Features/MFIB/Regime/Setups/Sessions indicators, VZ_FeaturesExport
  service, VZ_DumpMA, VZ_TogglePause
- margin-aware sizing, news, labels and session updates since 2026-07-14

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 13:48:22 -06:00
43 lines
2.2 KiB
MQL5
//+------------------------------------------------------------------+
//| VZ_TogglePause.mq5 — hotkey switch for the profitgtx entry pause |
//| |
//| Flips a terminal global variable that RiskGuardsAllowEntry() |
//| checks first on every entry attempt (RiskGuards.mqh). Open |
//| positions keep being managed; only new entries / re-entries stop.|
//| |
//| Bind to a key: Navigator -> Scripts -> right-click -> Set hotkey.|
//| Drop two copies (Scope 0 and 1) if you want both on hotkeys. |
//+------------------------------------------------------------------+
#property copyright "VizionAI"
#property version "1.00"
#property script_show_inputs
#property description "Toggle profitgtx new-entry pause (this symbol or all charts)."
enum ENUM_VZ_PAUSE_SCOPE { SCOPE_THIS_SYMBOL = 0, SCOPE_ALL_CHARTS = 1 };
input ENUM_VZ_PAUSE_SCOPE Scope = SCOPE_THIS_SYMBOL; // what to pause / resume
input bool Force_State = false; // true: set to Value instead of toggling
input bool Value = true; // used only with Force_State
void OnStart()
{
string key = (Scope == SCOPE_ALL_CHARTS) ? "VZ_PAUSE_ALL" : ("VZ_PAUSE_" + _Symbol);
bool cur = GlobalVariableCheck(key) && GlobalVariableGet(key) > 0.0;
bool next = Force_State ? Value : !cur;
if(next)
GlobalVariableSet(key, 1.0);
else if(GlobalVariableCheck(key))
GlobalVariableDel(key);
// Show what is in force now, both scopes, so a single key press is unambiguous.
bool all_paused = GlobalVariableCheck("VZ_PAUSE_ALL") && GlobalVariableGet("VZ_PAUSE_ALL") > 0.0;
string sym_key = "VZ_PAUSE_" + _Symbol;
bool sym_paused = GlobalVariableCheck(sym_key) && GlobalVariableGet(sym_key) > 0.0;
string msg = "profitgtx entries: " + (next ? "PAUSED" : "RESUMED") + " [" + key + "]"
+ " | all=" + (all_paused ? "paused" : "live")
+ " | " + _Symbol + "=" + (sym_paused ? "paused" : "live");
Print(msg);
Alert(msg);
}
//+------------------------------------------------------------------+