Download MetaTrader 5
To add comments, please log in or register
Find out how to install MetaTrader on Mac OS
gianluca
16
gianluca 2014.12.09 22:21 

hi guys

i have 10 opened charts and i'm using the code below to autoflip them.

#import "user32.dll"
   int GetParent(int hWnd);
   int SendMessageA(int hWnd, int Msg, int wParam, int lParam);
#import

#define WM_MDINEXT   548

extern int SlideShowSeconds = 5;

void start()
{
   while (!IsStopped()) {
      int hMDI = GetParent(GetParent(WindowHandle(Symbol(), Period())));
      SendMessageA(hMDI, WM_MDINEXT, 0, 0);

      Sleep(SlideShowSeconds * 1000);
   }
}

 

But.. is there a way to change the symbol directly inside a chart?

for example.. typing the symbols names in the chart box from a script/EA ( img below )  

i only need the windows/dll command, i can code the rest of the script myself 

thanks for helping


Halley
198
Halley 2014.12.10 06:12  
gianluca87:

hi guys

i have 10 opened charts and i'm using the code below to autoflip them.

 

But.. is there a way to change the symbol directly inside a chart?

for example.. typing the symbols names in the chart box from a script/EA ( img below )  

i only need the windows/dll command, i can code the rest of the script myself 

thanks for helping


Yes, it is possible with ChartSetSymbolPeriod.

Just it has a bit weird handling, when applied to a home chart.

After the command it runs like that:

- OnDeinit() with reason 3

- OnInit() with reason 3

!!! - After the OnInit() finished it runs the rest of the method, which triggered the command (e.g. OnTick) with the command following the ChartSetSymbolPeriod. 

 

So be sure you have a return statement following this command to avoid any mess.

gianluca
16
gianluca 2014.12.10 11:57  

you're great!! :)

i saw ChartSetSymbolPeriod in the documentation but i thougt that was a way to change the Period and not both.

thank you very much!

/
To add comments, please log in or register