Download MetaTrader 5

Moving SubChart

To add comments, please log in or register
They are already making profit from their signals. Publish your signal and join them!
Chr0n
13
Chr0n 2012.09.08 22:32 

Hey guys,

I have a bit of a problem with a SubChart.

Basically what I want to do is to display a chart within the chart and set it to a specific time.
Say, my main-chart should be 01.01.2012 and my sub-chart should be 01.01.1980 (or whatever).

I have tried to do it for several hours now, however, I was not able to move the chart.
I can rescale it, change the symbol, change the period, etc. but I can not change the dates which are shown in the chart - ie. it always shows the newest data.

For example:

int chartId = ObjectGetInteger(0,"SubChart",OBJPROP_CHART_ID);
ChartNavigate(chartId, CHART_BEGIN, 0);
ChartRedraw(chartId);

Hope someone can help.

Thanks in advance!

Gabor Torma
2676
Gabor Torma 2012.09.09 08:01  
It works only in EA.
Chr0n
13
Chr0n 2012.09.09 11:42  
VincentX:
It works only in EA.

Thank you, however, I am doing it in an Expert Advisor, if that is what you meant.

Gabor Torma
2676
Gabor Torma 2012.09.09 20:39  
Chr0n:

Köszönöm, de én csinálni egy Expert Advisor, ha ez az, amit jelent.

OBJPROP_CHART_ID is a long type not an int!

OBJPROP_CHART_ID

ID of the "Chart" object (OBJ_CHART). It allows working with the properties of this object like with a normal chart using the functions described in Chart Operations, but there some exceptions.

long


use this code:

long chartId = ObjectGetInteger(0,"SubChart",OBJPROP_CHART_ID);
ChartNavigate(chartId, CHART_BEGIN, 0);
ChartRedraw(chartId);
Chr0n
13
Chr0n 2012.09.11 21:46  
VincentX:

OBJPROP_CHART_ID is a long type not an int!

OBJPROP_CHART_ID

ID of the "Chart" object (OBJ_CHART). It allows working with the properties of this object like with a normal chart using the functions described in Chart Operations, but there some exceptions.

long


use this code:

lol how stupid am i?

It works now...

Thank you! :)

To add comments, please log in or register