Focus on MT5
Is this perhaps what you are looking for?
ChartSetInteger() with CHART_BRING_TO_TOP
Show chart on top of other charts
bool
with this, now both move, the mt5 charts and chrome tabs
!
help
//+------------------------------------------------------------------+ //| FlipChart | //| Copyright 2022, Yours | //| http://www.companyname.net | //+------------------------------------------------------------------+ #property strict #property indicator_chart_window #import "user32.dll" void keybd_event(int bVk, int bScan, int dwFlags,int dwExtraInfo); #import #define REL 0x0002 #define ALT 0x12 #define R 0x52 #define TAB 0x09 #define CTRL 0x11 static datetime Switch; int x; input int UpdateTime = 3; // after x seconds EA change the chart long chartToTop=1; long nextChart=-1; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { //--- create timer Switch = TimeCurrent(); x = 1; chartToTop = ChartFirst(); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { MqlDateTime mdt; TimeCurrent(mdt); if(TimeCurrent() > (Switch+x) ) { ChartSetInteger(chartToTop,CHART_BRING_TO_TOP,true); nextChart=ChartNext(chartToTop); chartToTop=nextChart; if(chartToTop==-1)chartToTop=ChartFirst(); // keybd_event(CTRL,0,0,0); // keybd_event(TAB,0,0,0); // keybd_event(CTRL,0,REL,0); // keybd_event(TAB,0,REL,0); Switch = TimeCurrent(); x = UpdateTime; } Comment("Flipping Charts ... "); } //+------------------------------------------------------------------+
Thanks a lot. got it.
Hi all, the above codes works ,,, and it flip the open charts every x seconds,
the only problem is ,, if i start working on Chrome (for example),,, the focus is shifted to chrome, and MT5 is not in focus any more and flipping action stops.
any good solution ?
regards