实现EA或脚本中关闭MT4软件方法?如何时在MQL代码中加入关闭MT4进程的方法?
问题
实现EA或脚本中关闭MT4软件方法?如何时在MQL代码中加入关闭MT4进程的方法?
解答
//+------------------------------------------------------------------+
//| 终止进程.mql4 |
//| Copyright 2020, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2020, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#import "kernel32.dll"
bool TerminateProcess(int handle,int code);
bool ExitProcess(int code);
#import
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
// 方法一
// TerminateProcess(-1,0);
// 方法二
ExitProcess(0);
}
//+------------------------------------------------------------------+
