Indicator window Time period changing.

 

I have tried using the following line in OnInit event of my Indicator.

Print(ChartSetSymbolPeriod(ChartWindowFind(),_Symbol,Period_Time),"  ", GetLastError());

I am getting the right values of the window, but the output of the above statement is 

false 0

I want to change the subwindow or the indicator window time period.

Please let me know what I have missed.

 

ChartWindowFind

The function returns the number of a subwindow where an indicator is drawn. 

1. The function searches in the indicated chart for the subwindow with the specified "short name" of the indicator (the short name is displayed in the left top part of the subwindow), and it returns the subwindow number in case of success.

int  ChartWindowFind(
   long     chart_id,                  // chart identifier
   string   indicator_shortname        // short indicator name, see INDICATOR_SHORTNAME
   );

2. The function must be called from a custom indicator. It returns the number of the subwindow where the indicator is working.

int  ChartWindowFind();


Custom Indicator Properties - Indicator Constants - Constants, Enumerations and Structures - MQL4 Reference
Custom Indicator Properties - Indicator Constants - Constants, Enumerations and Structures - MQL4 Reference
  • docs.mql4.com
A custom indicator has a lot of settings to provide convenient displaying. These settings are made through the assignment of corresponding indicator properties using functions IndicatorSetDouble(), IndicatorSetInteger() and IndicatorSetString(). Identifiers of indicator properties are listed in the ENUM_CUSTOMIND_PROPERTY enumeration...
 
Marco vd Heijden:

ChartWindowFind

The function returns the number of a subwindow where an indicator is drawn. 

1. The function searches in the indicated chart for the subwindow with the specified "short name" of the indicator (the short name is displayed in the left top part of the subwindow), and it returns the subwindow number in case of success.

2. The function must be called from a custom indicator. It returns the number of the subwindow where the indicator is working.




You are absolutely correct Sir. But I want to change the period of the sub-window. Hence I am trying to get the ID with the help of ChartWindowFind() function so that I can change the time period of the indicator window only without disturbing the symbol chart period.

That is my intention behind this. Please help me.

 
ChartSetSymbolPeriod

Sets the Chart Symbol/Period.

Not the subwindow, or at least the chart and the subwindow given that ChartID() == 0.

You can just use data from a differnt timeframe to plot into the subwindow.
 
Marco vd Heijden:

Sets the Chart Symbol/Period.

Not the subwindow, or at least the chart and the subwindow given that ChartID() == 0.

You can just use data from a differnt timeframe to plot into the subwindow.

Thank you Sir, for the advise and references.

Reason: