Friends,
I am experiencing a bit of a frustrating problem... probably simple but any advice appreciated.
When running my custom indicator, the default window period (when the chart pops up) is always 1 hour. I change it within my OnInit function as follows:
However, from that point on, even after the current chart updates to the new period (1 minute), _Period persists as showing as 1 hour, no matter what, even after the ChartSetSymbolPeriod call. This is problematic when adding indicators to my chart and avoiding Error 4114.
1. What am I missing? How do I get the _Period to reflect the current chart?
2. How do I change the default chart period from the 1 hour? I cannot locate the setting that accomplishes this.
Thanks in advance.
How are you getting the value of _Period ?
For M1 chart, _Period is 1
For H1 chart, _Period is 16385
Set up a chart as you like with the time-frame as you want for default. Save the template and name it default.
Thanks for the response. I am looking at the _Period in my Debug window. Before OnInit ever runs, it loads up the 1H chart, and _Period is perpetually 16385. This occurs after loading my default chart of 1M.
My steps:
1. Close all charts. Load default chart, whose period is set to 1M.
2. Start debug on realtime data
3. 1H chart pops up/loads up on over top of the 1M default chart and in debug window: _Period = PERIOD_1H (16385). It stays that way for the remainder, even after I let the OnInit run.
What am I missing? Thanks.
Thanks for the response. I am looking at the _Period in my Debug window. Before OnInit ever runs, it loads up the 1H chart, and _Period is perpetually 16385. This occurs after loading my default chart of 1M.
My steps:
1. Close all charts. Load default chart, whose period is set to 1M.
2. Start debug on realtime data
3. 1H chart pops up/loads up on over top of the 1M default chart and in debug window: _Period = PERIOD_1H (16385). It stays that way for the remainder, even after I let the OnInit run.
What am I missing? Thanks.
If you enable debugging, you must configure the chart period and symbol:
What am I missing? Thanks.
I never use debug mode so I cannot comment.
Vladimir,
That is exactly what I was missing. Not sure how I missed that before, but problem solved! Thank you very much for your assistance.
Thank you as well, Keith.
You guys rock.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Friends,
I am experiencing a bit of a frustrating problem... probably simple but any advice appreciated.
When running my custom indicator, the default window period (when the chart pops up) is always 1 hour. I change it within my OnInit function as follows:
However, from that point on, even after the current chart updates to the new period (1 minute), _Period persists as showing as 1 hour, no matter what, even after the ChartSetSymbolPeriod call. This is problematic when adding indicators to my chart and avoiding Error 4114.
1. What am I missing? How do I get the _Period to reflect the current chart?
2. How do I change the default chart period from the 1 hour? I cannot locate the setting that accomplishes this.
Thanks in advance.