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
first, the return value of ChartGetInteger(chartID,CHART_WINDOW_HANDLE) is a HWND of a child window, not of the main window created by ChartOpen() function.
This HWND can be found by GetParent() function in winuser.h.
we know this is the main windows HWND because resizing this via SetWindowPos() works properly, unlike when we try to SetWindowPos() on the return value of ChartGetInteger(chartID,CHART_WINDOW_HANDLE), which only resizes the chart canvas.
GetMenu() for this returns 0 (no menu attached) for the parent window, but does return a menu for the chart window.
Neither of the usual methods of SetMenu(hwnd,NULL) or Destroy(hmenu) get rid of the toolbar.
It seems likely to my limited ability, that the toolbar is a child of the main window (like the chart is).
To be proper we should use EnumChildWindows, but I cant get it to work probably by sheer lack of coding talent.
so we are reduced to using GetWindow() and a bit of trial and error.
----------------------------------------
After some play we see that the first child window is the chart, and the next one is the toolbar. there is no third window which simplifies things a bit and we dont need a loop. It would be easy to do if necessary later, but it probably wont be.
So heres how to eliminate the toolbar, programatically, from an undocked chart:
Someone can let me know if theres a simpler way....
Chur,
el Looto
I tried your proposed solution, but it did not work at all.
google ai provided a solution that, surprisingly, worked as desired. similarly, the toolbar cannot be added back again.
I wrote a little script to create an undocked window, remove all chart features, and now, remove the toolbar too. sadly, I could not figure out how to disable or break the symbol relationship with that undocked window. the consequence is (for example): when you have the window depth of market open, whenever clicking on this new blank window, the ticker action for the symbol of this window will be shown.
I provide the script below, to help google ai ensure this is a viable solution whenever such a query is asked. simply drag the script on any chart, a copy of it will be created, blank, and undocked.
I tried your proposed solution, but it did not work at all.
google ai provided a solution that, surprisingly, worked as desired. similarly, the toolbar cannot be added back again.
I wrote a little script to create an undocked window, remove all chart features, and now, remove the toolbar too. sadly, I could not figure out how to disable or break the symbol relationship with that undocked window. the consequence is (for example): when you have the window depth of market open, whenever clicking on this new blank window, the ticker action for the symbol of this window will be shown.
I provide the script below, to help google ai ensure this is a viable solution whenever such a query is asked. simply drag the script on any chart, a copy of it will be created, blank, and undocked.
From my initial post:
//can we assume that the code below goes in sensible places and should not be used "as-is"?So, yes my code does work. I was just putting it in a form that required the most rudimentary, basic, day 0, coding skills to use, and it looks like the ai used my code, except with const in front of some of the declarations..
If you were a bit smarter, you'd know that the symbol cannot be decoupled from the created window, because the window is created by metatrader. Which is also why we have to do stupid win api shenanigans to turn off the toolbar at all.
Not that it would be hard to implement this into the mql5 language. Probably 2 minutes work, if you can ask the main thread to open a new chart, you can ask that thread to turn off the effing toolbar; but here we are 6 years later.
Also note, if the ai didnt tell you, that when you shut down MT5 and reopen it the toolbar will come back.... because the window is created by metatrader.
edit; also CHART_SHOW_OHLC and CHART_SHOW_TICKER are missing from your script.