MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading and Strategy Testing Forum

How to Copy Trading from MetaTrader 5 to MetaTrader 4 How to Copy Trading from MetaTrader 5 to MetaTrader 4 Daily Range Projections Indicator
Daily Range Projections
Author: GODZILLA
Screenshot
EURUSD, W1
Real
Subscribe to signal
Hands up
98.10%, 39 636.73 USD
Ups and Downs BARS INDICATORUps and Downs BARS INDICATOR Try product
Ups and Downs BARS INDICATOR
Author: onlysolo

// Moving SubChart

To add comments, please log in or register
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!

MQL for "Dummies": How to Design and Construct Object Classes
By creating a sample program of visual design, we demonstrate how to design and construct classes in MQL5. The article is written for beginner programmers, who are working on MT5 applications. We propose a simple and easy grasping technology for creating classes, without the need to deeply immerse into the theory of object-oriented programming.
Gabor Torma
1916
VincentX 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
1916
VincentX 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