MQLArticles/Utils/ExtraFunctions.mqh
2026-02-23 07:31:01 -05:00

44 lines
1.6 KiB
MQL5

//+------------------------------------------------------------------+
//| ExtraFunctions.mqh |
//| Copyright 2025, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2025, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372"
#property strict
#ifndef MQLARTICLES_UTILS_EXTRAFUNCTIONS_MQH
#define MQLARTICLES_UTILS_EXTRAFUNCTIONS_MQH
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "..\\..\\ExtraCodes\\MultiTester\\MTTester.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
void TerminalAutoTrading(bool enable)
{
//---
const bool e = (bool)TerminalInfoInteger(TERMINAL_TRADE_ALLOWED);
if(e == enable)
return;
//---
HANDLE hwnd = MTTESTER::GetTerminalHandle();
if(!hwnd)
return;
//---
user32::SetForegroundWindow(hwnd);
Sleep(50);
//---
user32::keybd_event(0x11, 0, 0, 0);
user32::keybd_event(0x45, 0, 0, 0);
user32::keybd_event(0x45, 0, 2, 0);
user32::keybd_event(0x11, 0, 2, 0);
}
//+------------------------------------------------------------------+
#endif // MQLARTICLES_UTILS_EXTRAFUNCTIONS_MQH