Hydra Corporation:
Specify the sub window when creating the object. See the documentation
I'm creating a "Symbol Changer" indicator in MQL5 that should display currency pair buttons in a separate window below the main chart. The goal is for the buttons to appear in the indicator's own window (similar to how an RSI indicator would display), without overlaying the main chart.
Here's what I've done so far:
- I set #property indicator_separate_window to create a separate window.
- I used ObjectCreate() with OBJ_BUTTON to create buttons for each currency pair.
- I tried to ensure that the buttons appear in the separate window by using ChartID() instead of 0 when calling ObjectCreate() and ObjectSetInteger() for positioning.
- The OnCalculate function is empty, as no calculations or plots are needed for this indicator.
Despite these efforts, the buttons keep appearing over the main chart rather than in the separate window below it. Increasing the height of the indicator window doesn’t resolve the issue, and I can't get the buttons to stay confined to the indicator's own space.
Code Example: Here’s a simplified version of the code I'm using to create the buttons:
Your topic has been moved to the section: Technical Indicators
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Hydra Corporation: I tried to ensure that the buttons appear in the separate window by using ChartID() instead of 0 when calling ObjectCreate() and ObjectSetInteger() for positioning.
- Using ChartID instead of zero is irrelevant. You want to create the object on a subwindow of the current chart.
- Where do you find the sub-window index (where your indicator is running) and pass it to ObjectCreate? What is sub-window zero? Read the documentation.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'm creating a "Symbol Changer" indicator in MQL5 that should display currency pair buttons in a separate window below the main chart. The goal is for the buttons to appear in the indicator's own window (similar to how an RSI indicator would display), without overlaying the main chart.
Here's what I've done so far:
Despite these efforts, the buttons keep appearing over the main chart rather than in the separate window below it. Increasing the height of the indicator window doesn’t resolve the issue, and I can't get the buttons to stay confined to the indicator's own space.
Code Example: Here’s a simplified version of the code I'm using to create the buttons: