Download MetaTrader 5
To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
Zoltan Petres
7
Zoltan Petres 2014.06.25 11:17 

Hi,

I am struggling to solve the following problem:  I have many charts open on which I am running different analysis. In most cases, there is no action of visual check needed, but in some cases yes. What I want is to send an alarm sound, plus bring the chart in front.

I have tried many user32.dll functions to achieve this, without success. Here is my latest try. Before, I tried with the function SetForegroundWindow() as well. 

#import "user32.dll"
bool ShowWindow(int hWnd, int nCmdShow);
bool BringWindowToTop(int hWnd);
#import

string Symb;
string Per;

if (rsi<50)
{
    Symb = Symbol();
    Per = Period();
    PlaySound("connect.wav");
        
    int hMDI = WindowHandle(Symb, Per);
    BringWindowToTop(hMDI);
    ShowWindow(hMDI, 5);
}


Does anyone has some idea how to achieve it?

Thanks,

Zoltan 

Drazen Penic
2408
Drazen Penic 2014.06.25 12:13  

You can do it with MQL4 only:

 

ChartSetInteger(0,CHART_BRING_TO_TOP,0,true);  // first argument determines chart

 

See documentation  for ChartSetInteger() and CHART_BRING_TO_TOP example

/
To add comments, please log in or register