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.
- 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!