Download MetaTrader 5
To add comments, please log in or register
Do you have questions on how to turn your idea into reality? Ask them on the Forum!
kenned45900 2013.11.21 17:29 


Is there a code that automaticly remove only the EA on current chart? I havde tried :

PostMessageA( WindowHandle( Symbol(), Period()), WM_COMMAND, 33050, 0);

but it removed the EA on all charts?

Ian Flanagan
Ian Flanagan 2013.11.21 18:10  

untested but try this for a start:

#import "user32.dll"
   int GetAncestor(int hWnd, int gaFlags);
   int GetDlgItem(int hDlg, int nIDDlgItem);
   int PostMessageA(int hWnd, int Msg, int wParam, int lParam);

#define WM_COMMAND   0x0111
#define WM_KEYDOWN   0x0100
#define VK_HOME      0x0024
#define VK_DOWN      0x0028

void start() {
   string symb = Symbol();
   int hFile, SymbolsTotal, hTerminal, hWnd;

   hFile = FileOpenHistory("symbols.sel", FILE_BIN|FILE_READ);
   if(hFile < 0) return(-1);
   SymbolsTotal = (FileSize(hFile) - 4) / 128;
   FileSeek(hFile, 4, SEEK_SET);

   hTerminal = GetAncestor(WindowHandle(Symbol(), Period()), 2);

   hWnd = GetDlgItem(hTerminal, 0xE81C);
   hWnd = GetDlgItem(hWnd, 0x50);
   hWnd = GetDlgItem(hWnd, 0x8A71);

   PostMessageA(hWnd, WM_KEYDOWN, VK_HOME, 0);

   for(int i = 0; i < SymbolsTotal; i++)
      if(FileReadString(hFile, 12) == symb) {
         PostMessageA(hTerminal, WM_COMMAND, 33050, 0); break;
      PostMessageA(hWnd, WM_KEYDOWN, VK_DOWN, 0);
      FileSeek(hFile, 116, SEEK_CUR);



kenned45900 2013.11.21 20:39  
Nice. It works great. Thanks:-)
Ian Flanagan
Ian Flanagan 2013.11.22 01:58  
I'm not sure if you have to right click "Show All" in the market watch first.. might give strange results if you don't. check it.
To add comments, please log in or register