Have a look at the code of the primary indicator file and the moving average subsidiary indicator file in the link below. When I was coding those indicators, I encountered a conflict between the primary separate window indicator and the main chart window moving average indicator. My solution was to change the moving average indicator #property to indicator_separate_window. This setup does not have the bugs that you mentioned.
Ryan L Johnson, 2025.04.29 19:52
This indicator calls 3 other subwindow indicators. All files go in your Indicators folder.Have a look at the code of the primary indicator file and the moving average subsidiary indicator file in the link below. When I was coding those indicators, I encountered a conflict between the primary separate window indicator and a main chart window moving average indicator. My solution was to change the moving average indicator #property to indicator_separate_window. This setup does not have the bugs that you mentioned.
Both indicator_separate_window and indicator_chart_window suffer from the exact same issue, and in my opinion, it makes no sense when calling them via iCustom.
From the standpoint of the terminal, every indicator has to run in a window. Chart window indicators use the symbol's price scale as a y-axis, while separate window indicators use an independent oscillation range as a y-axis.
Does that make sense?
By the way, there is also a "self-contained" custom iMAOnArrary() function at the bottom of the primary indicator file, Brooky_Trend_Strength, that you might consider as a workaround.Hello everyone,
I am working with custom indicators and have run into a very frustrating issue regarding indicator handles and subwindows. I hope someone here can shed some light on this.
Currently, I am calling Indicator_2 using iCustom , and I pass the handle of Indicator_1 as the data source (the last parameter). It works perfectly at first. When I open the indicator properties on the chart, the "Apply to" field correctly shows "Previous Indicator's Data".
However, I have three questions regarding this setup:
1. Passing "First Indicator's Data" via code: Is there a way to call iCustom and explicitly set it to use "First Indicator's Data" instead of "Previous Indicator's Data" without manually passing the Indicator_1 handle in the parameter?
No you have to pass an handle, nothing else if you are using the "short" version of OnCalculate inside your indicator.
2. The Timeframe Reset Issue (My biggest problem): When I change the timeframe on the chart, the indicator completely loses its data link. The "Apply to" parameter of Indicator_2 automatically resets to "Close" instead of maintaining "Previous Indicator's Data".
Is there any trick, workaround, or proper method to prevent MT5 from breaking this handle link and reverting to "Close" upon timeframe changes?
Working with ChartIndicatorAdd() is very tricky for anything non-trivial.
3. Subwindow Scaling: By the way, is there a way to force Indicator_2 to strictly follow the scale (min/max values) of Indicator_1 ? I want to attach multiple indicators (more than two) into the exact same subwindow.
Any guidance, code snippets, or advice would be highly appreciated!
Unfortunately there is no easy to get min/max values from one indicator or to inherit scale by code.
Working with nested indicators is not an easy task if you need visualization. Not even talking with you have more than 2 levels. It's possible but require a lot of efforts.
I would rather suggest you to code all inside one indicator.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
I am working with custom indicators and have run into a very frustrating issue regarding indicator handles and subwindows. I hope someone here can shed some light on this.
Currently, I am calling Indicator_2 using iCustom , and I pass the handle of Indicator_1 as the data source (the last parameter). It works perfectly at first. When I open the indicator properties on the chart, the "Apply to" field correctly shows "Previous Indicator's Data".
However, I have three questions regarding this setup:
1. Passing "First Indicator's Data" via code: Is there a way to call iCustom and explicitly set it to use "First Indicator's Data" instead of "Previous Indicator's Data" without manually passing the Indicator_1 handle in the parameter?
2. The Timeframe Reset Issue (My biggest problem): When I change the timeframe on the chart, the indicator completely loses its data link. The "Apply to" parameter of Indicator_2 automatically resets to "Close" instead of maintaining "Previous Indicator's Data".
Is there any trick, workaround, or proper method to prevent MT5 from breaking this handle link and reverting to "Close" upon timeframe changes?
3. Subwindow Scaling: By the way, is there a way to force Indicator_2 to strictly follow the scale (min/max values) of Indicator_1 ? I want to attach multiple indicators (more than two) into the exact same subwindow.
Any guidance, code snippets, or advice would be highly appreciated!
Thank you very much in advance!