Moving SubChart

 

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!

 
It works only in EA.
 
VincentX:
It works only in EA.

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

 
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);
 
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! :)