I have this script for vertical cascade-like arrangement.
//+----------------------------------------------------------------------------------------------------+ //| windowresize.mq5 | //+----------------------------------------------------------------------------------------------------+ #import "user32.dll" int GetParent(long hWnd); bool SetWindowPos(int hWnd, int hWndInsertAfter, int x, int y, int width, int height, uint uFlags); void keybd_event(int bVk, int bScan, int dwFlags, int dwExtraInfo); #import void OnStart() { if(ChartGetInteger(0,CHART_IS_MAXIMIZED,0)==1) { keybd_event(0x12,0,0,0); keybd_event(0x52,0,0,0); keybd_event(0x12,0,0x0002,0); keybd_event(0x52,0,0x0002,0); } long FirstChartID = ChartFirst(); long SecondChartID = ChartNext(FirstChartID); long ThirdChartID = ChartNext(SecondChartID); long FourthChartID = ChartNext(ThirdChartID); long FirstChartHandle, SecondChartHandle, ThirdChartHandle, FourthChartHandle; int FirstChartParentHandle, SecondChartParentHandle, ThirdChartParentHandle, FourthChartParentHandle; ChartGetInteger(FirstChartID,CHART_WINDOW_HANDLE,0,FirstChartHandle); ChartGetInteger(SecondChartID,CHART_WINDOW_HANDLE,0,SecondChartHandle); ChartGetInteger(ThirdChartID,CHART_WINDOW_HANDLE,0,ThirdChartHandle); ChartGetInteger(FourthChartID,CHART_WINDOW_HANDLE,0,FourthChartHandle); FirstChartParentHandle=GetParent(FirstChartHandle); SecondChartParentHandle=GetParent(SecondChartHandle); ThirdChartParentHandle=GetParent(ThirdChartHandle); FourthChartParentHandle=GetParent(FourthChartHandle); SetWindowPos(FourthChartParentHandle,0,1288,0,640,958,0); SetWindowPos(ThirdChartParentHandle,0,900,0,640,958,0); SetWindowPos(SecondChartParentHandle,0,450,0,640,958,0); SetWindowPos(FirstChartParentHandle,0,0,0,620,958,0); } //+----------------------------------------------------------------------------------------------------+
It is calibrated for 4 charts on a FHD screen. It's for MT5, for MT4 I think handles had to be declared as longs.
kypa:
Hey thanks for this, I'll have a go amending this for MQL4.
I have this script for vertical cascade-like arrangement.
It is calibrated for 4 charts on a FHD screen. It's for MT5, for MT4 I think handles had to be declared as longs.
kypa: for MT4 I think handles had to be declared as longs.
Don't think, read the documentation and be sure:
Returns the chart ID of the chart next to the specified one.
Then write self-documenting codelong ChartNext( long chart_id // Chart ID );ChartNext - Chart Operations - MQL4 Reference
#define CHART_ID long #define CHART_INVALID (CHART_ID) -1
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I'm writing a script to setup a workspace. From the main toolbar, if you select "Window" you get a dropdown list. I can't find the functions that perform these actions. Do they exist?
Also is there any code to minimise and maximise a chart window?
Thanks.