MQL4 - automated forex trading   /  

Forum

Login | Register | Language: ru cn en
The Largest Collection of Forex Robots is on Display in MQL 5 Code Base

Remove an EA through MQL4 code

Back to topics list To post a new topic, please log in or register
avatar
25
gjrexach 2011.05.07 03:11
 

Hi:

Does anybody know if there is a way to remove an active EA/INDICATOR programmatically(using MQL4 code), rather than manually(going to the EA/INDICATOR properties and removing it)?

Any responses will be appreciated

 
USDCHF intraday forecast
USDCHF intraday forecast
oleksandr bilokon | 19 December 2014, 06:41 | Views: 80
The indicator of OsMA, marking divergence and decline of bovine activity on the hasp of Down- of trend, gives founding to priority of planning of trade operations of correction with advantage of sales to date. Presently, taking into account the current orientation of indicator, we expect the return of course to the nearest levels of broken through Down -trend (0,9737/27) or key levels of supports (1th from 0,9678 to 0,9793, 2th from 0,9649 to 0,9720 by the end of day), where and it is recommended to estimate development of activity of parties in accordance with the charts of less temporal interval.
avatar
438
forexCoder 2011.05.07 03:15 #
 

Not in Mql4 afaik.

Mql5 has this functionality built in.

avatar
10044
avatar
438
forexCoder 2011.05.08 04:18 #
 
Woop 0.o bloody nice.
avatar
25
gjrexach 2011.05.30 22:13 #
 

Sorry for late response. Didnt think anybody would answer it intelligently. Thank you VERY MUCH .. Havent tried it but will soon.

BTW... read your post on the link... I agree with you. Although I am a firm believer in "The only stupid question is the one you dont ask", as all rules go,"Every Rule has an exception,EXCEPT THIS ONE"

Thanks again

WHEN ALL ELSE FAILS, READ THE INSTRUCTIONS...

 
avatar
4
royclark 2013.08.13 04:55 #
 

Hi I have not seen any real answer to this question, now 2 years old. So I propose the solution in code form. Easy really when you know how.!

PS If you really like this code (only mt4 coding necessary) maybe you will put a couple of likes somewhere.

//+------------------------------------------------------------------+
//|                                                 test.mq4         |
//| OPERATION:-                                                      |
//|  test  drop EA from chart                                        |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
#property show_inputs
#property stacksize 1024
#define MT4_WMCMD_REMOVE_EXPERT   33050 /* Remove expert advisor from chart */
#define MT4_WMCMD_EXPERT_INPUTS   33048 /* Open expert Inputs dialog */
#include <stderror.mqh>
#include <stdlib.mqh>
#include <WinUser32.mqh> // required for MessageBox()
// --- user32.dll is required for MessageBoxA and PostMessageA
#import "user32.dll"
   int    MessageBoxA(int hWnd, string lpText, string lpCaption, int uType);
#import
//  MessageBoxA Parameters:
//  hWnd      -   Windowshandle() Chart symbol
//  lpText    -   Optional text that contains the message to be displayed. or NULL 
//  lpCaption -   Optional text to be displayed in the header of the dialog box. If NULL displays the expert name. 
//  uType     -   Optional flags that determine the type of buttons displayed as per flags in MessageBox().
//                eg. MB_OK MB_OKCANCEL MB_YESNO
//  return codes - As MessageBox() eg IDOK IDCANCEL IDABORT IDYES IDCONTINUE says these buttons were selected                  
//  PostMessageA Parameters:
//               PostMessageA(hWnd, WM_COMMAND, mydefine, 0);
//  hWnd      -   Windowshandle() Chart symbol
//  WM_COMMAND-   Windows Command instruction
//  mydefine  -   Any #define integer from aswincmds.mqh  
//---- input parameters . WinUser32 above is required for messagebox

// messageboxA and PostMessageA variables
int            hWnd, uType, mydefine;
string         lpText, lpCaption; 

//+------------------------------------------------------------------+
//| program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
  
  Print("Trying to drop expert from chart");
  // string name=WindowExpertName(); 
  // GlobalVariablesDeleteAll(name);
// remove the comment slashes above if you really want to delete Globals
  hWnd=WindowHandle(Symbol(),0);                                               
  lpText="Your subscription has expired, so I will now remove the Expert from the Chart";
  lpCaption="Subscription Expired "+WindowExpertName();
  uType=MB_OK;
  mydefine=MT4_WMCMD_REMOVE_EXPERT;
  MessageBoxA(hWnd,lpText,lpCaption,uType); // display removing Expert message with only "OK" button
  PostMessageA(hWnd, WM_COMMAND, mydefine, 0); // drop from chart
  
 
  
  } // end start
  

 
avatar
10044
WHRoeder 2013.08.13 16:47 #
 
royclark: I have not seen any real answer to this question, now 2 years old.
Why did you dig up a two year old post that already had the links to How do I close an Expert programmatically? - MQL4 forum http://forum.mql4.com/26236#264937 and #define's for known commands that can be used for PostMessageA() - MQL4 forum and post exactly the same thing?





 
Back to topics list  

To add comments, please log in or register