Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
@ktrade, I was wondering - do you think it is possible to modify the toolbar (menu bar) of Sierra, like what is popularly done with Ninja these last few years?
Initial idea is mainly to add buttons - like toggle switches for hide on/off indicators.
Yes, I believe something along those lines is possible. Although we would need to thread carefully as there are frequent updates to sierra so when modifying things outside the published api might break in future releases.
Also, a study can define 4 toolbar buttons through the api, but they will belong to the study, meaning more general functionality would not be possible.
And I want to clarify because my terminology may be wrong...
I use undocked charts only. So I am NOT talking about the main Sierra "toolbar" (as they call it). I am instead talking about each undocked chart window, the menubar of that window (Edit, Tools) having some buttons added to the right to control some stuff, like switching on/off studies or a nice one would be sharing a chart (ftp) etc.
They can be right justified too . Icons are the same difficulty - the screenshot is an actual screenshot of my sierra so they are already there (the background blitting, is off by a pixel so it looks odd - but its possible to fix (thats why the icons background are a bit off - the whole mess is because the bitmaps can not be transparent here, so i copy the backbackgroup draw the icon and put the bitmap back, but is off by a pixel) - also as you might notice the menubar is higher than normal, to fit the 32x32 icons - but any size is ofcourse possible if it is prefered to keep the menubar the original size.
What kind of functionality did you have in mind to attach to these buttons , the one I made and took the screen shot off, switches the chart symbol between 4 currency futures.
It sounds like it would be best to define a generic way to add buttons and hook it into calling functions in sierra, either through the api or by making lower levels hooks into sierra - so we get a more customizable solution.
I will try to make an initiel version that displays the different handles we can attach to in sierra and then we can hopefully get some ideas and input to how it is best utilized.
they are not actually buttons in this case, but I had to make them as menu-items as they went to the menu-bar:
To get the menu i get the window handle of the chart-window inside the study (this is for detached charts)
then i get the main menu:
then i add the 4 menu-items as bitmap items:
I just load the icons from my disk as it makes it easier to change for me , you can also have them as resources directly in your dll.
notice you would need to check if you already added something for, a very simple check would be the menu item count:
Notice I gave my menu items id's 103992-103995, i just chose them arbitrarily as numbers not conflicting with sierra.
To be able to listen if anyone pressed your menu items you would need to hook into the message loop by:
When a menu item is selected you would get WM_COMMAND so your CallWndProc would need to listen to this:
As this requires you to keep some data outside of sierra I would have my own datastructures in the dll, to keep track of which windows i have buttons in (and thus not use the study's capabailities of storing data).
you also need to unhook your wndproc hook when you are done.
Also, a sierra study is a normal dll, so you can do some initialization and other things as normal in DLLMain:
I just choose to save dll instance in a static instance, as it will only be loaded once. You could choose to clean up, if you had saved all the structures "yourself" (as oppose to save them with the study) when you are detached.
Another, much simpler way, would be to use the built-in capabilities to add 4 buttons pr study to a study toolbar, but they dont give you the same degree of flexibility, but you can have buttons and get notified when they are pressed directly in the study.