Jump to past date of a chart, with mql4 CODE

 

How to jump to a past date on the chart with an MQL4 code.


I want this to be done by my indicator, with MQL4 code, for example if i write into my indicator to jump to 2010.1.1, then the indicator should move the chart to that date.

Is it possible, if yes, then please tell me how :)

 
Proximus:

How to jump to a past date on the chart with an MQL4 code.


I want this to be done by my indicator, with MQL4 code, for example if i write into my indicator to jump to 2010.1.1, then the indicator should move the chart to that date.

Is it possible, if yes, then please tell me how :)



It's probably possible using WinAPI and PostMessage. Search the forum for more info.
 
angevoyageur:
It's probably possible using WinAPI and PostMessage. Search the forum for more info.


I did, i didnt found anything about moving charts to a date.


Can you please be more specific, or please give me a tutorial how to do it, thanks!

 
Proximus:

I did, i didnt found anything about moving charts to a date.


Can you please be more specific, or please give me a tutorial how to do it, thanks!

https://www.mql5.com/en/forum/124688
 

Yes, but how do i know which command controls the date-editor, or how do i control that.

There could be 2 possible methods i thought of, one is to simulate the left/right arrow buttons, and use that mqh header to simulate those buttons, but that wont be very elegant, as for example if i want to jump back 12456 candlesticks in the past how do i do that, or how do i know how many times i need to press the left arrow key to do that?

The other way which would be the perfect way, is to somehow control that "date-editor", with MQL4 code from an indicator or script

Now please need help with that, i dont even know what parameters control that box, please help!

 
Proximus:

How to jump to a past date on the chart with an MQL4 code.


I want this to be done by my indicator, with MQL4 code, for example if i write into my indicator to jump to 2010.1.1, then the indicator should move the chart to that date.

Why ? if you need to take a Screenshot then you can do that without moving the chart . . .
 
Proximus:

Yes, but how do i know which command controls the date-editor, or how do i control that.

There could be 2 possible methods i thought of, one is to simulate the left/right arrow buttons, and use that mqh header to simulate those buttons, but that wont be very elegant, as for example if i want to jump back 12456 candlesticks in the past how do i do that, or how do i know how many times i need to press the left arrow key to do that?

The other way which would be the perfect way, is to somehow control that "date-editor", with MQL4 code from an indicator or script

Now please need help with that, i dont even know what parameters control that box, please help!

You have to do your own research, the second solution is certainly possible but I am not personally interested to do it. Maybe someone has already done it, but I am not aware of that.

When you press Enter key on a chart, the Fast Navigation Box receive the focus, so you have only to "mimic" these inputs.

 
RaptorUK:
Why ? if you need to take a Screenshot then you can do that without moving the chart . . .


What do you mean by "need to take a screenshot", what i meant is to move the chart to a date with mql4 code, not manually.

I need to analyze past data with my indicator, it will be a complex process, and probably just for lazyness but its more convenient if my indicator can move the chart for me.And i want my indicator to jump to past dates by setting the dates in my indicator external parameters, not on the navigator box line.


Ok i followed angevoyageur 's advice and did a little research on the user32.dll

I got a little progress but now i`m stuck, so i need help from someone who understands it better than me.

What i did is this:

#import "user32.dll"
void keybd_event(int bVk,int bScan,int dwFlags,int dwExtraInfo);
               int      SetWindowTextA(int hWnd,string lpString);
                  int      GetActiveWindow();
                  
#import
#define VK_RETURN 13 //ENTER key

int init()
{
 keybd_event(VK_RETURN,0,0,0);
 SetWindowTextA(GetActiveWindow(),"2012.1.1 10:30");

//----
   return(0);
  }


Now this succesfully opens the navigator box, since it presses the "enter" key, which is the shortcut for the navigator box, but it doesnt write the date

2012.1.1 10:30

Into it.

I please need some help with this one, thanks!

 
Proximus:

I need to analyze past data with my indicator, it will be a complex process, and probably just for lazyness but its more convenient if my indicator can move the chart for me.

Just in case you hadn't realised . . . you don't need to move the chart for your Indicator to analyse the data from a particular date.
 
RaptorUK:
Just in case you hadn't realised . . . you don't need to move the chart for your Indicator to analyse the data from a particular date.

I meant visually analyse, the indicator will plot the usual data and lines, but i want to visually analyse it also to check tops/bottoms and that sort of stuff.

So i have a justification for this requirement, so i must use indicator based chart date navigation :)


So if anyone can help me with the code where i got stuck, i will highly appreciate it.

 
Proximus:

I meant visually analyse, the indicator will plot the usual data and lines, but i want to visually analyse it also to check tops/bottoms and that sort of stuff.

So i have a justification for this requirement, so i must use indicator based chart date navigation :)


So if anyone can help me with the code where i got stuck, i will highly appreciate it.

OK, so take a screen grab automatically and manually visual analyse that . . .