Open 5 charts from M1 to H1 of the same symbol. Turn off AutoScroll. Main menu - Window - Tile horizontally.
Take following script
Take following script
//+------------------------------------------------------------------+
//| ChartScroll.mq4 |
//| Copyright © 2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
#import "user32.dll"
int RegisterWindowMessageA(string);
int PostMessageA(int hWnd,int Msg,int wParam,int lParam);
#import
int MT4InternalMsg=0;
datetime first_pos;
int periods[5]={ PERIOD_M1,PERIOD_M5,PERIOD_M15,PERIOD_M30,PERIOD_H1 };
int handles[5];
int init()
{
//----
MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message");
Print("Registered message ",MT4InternalMsg);
first_pos=Time[FirstVisibleBar()];
//----
for(int i=0; i<5; i++)
{
if(periods[i]!=Period())
{
handles[i]=WindowHandle(Symbol(),periods[i]);
if(handles[i]==NULL) Print(Symbol(),",",periods[i]," not found");
}
else handles[i]=NULL;
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
datetime pos;
//----
while(!IsStopped())
{
pos=Time[FirstVisibleBar()];
if(first_pos!=pos)
{
first_pos=pos;
for(int i=0; i<5; i++)
{
if(handles[i]!=NULL) PostMessageA(handles[i],MT4InternalMsg,55,first_pos+periods[i]*60);
}
}
Sleep(100);
}
//----
return(0);
}
//+------------------------------------------------------------------+
compile it and attach it to the M15 chart (don't forget to check on "Allow DLL imports")
Scroll M15 chart and see parallel scrolling of other charts
This PostMessage
PostMessageA(handles[i],MT4InternalMsg,55,first_pos+periods[i]*60);
navigates charts according datetime from M15 chart
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
If I have a chart's autoscroll set off i can hit the spacebar then type in a datetime then hit enter and it will horizontally scroll the chart to that datetime.
Can a script force a chart to horizontally scroll to a certain datetime? If so, how?
Thanks!