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)
In this thread, a generous user contributed some code that takes advantage of Sierra's new ACS functionality which allows catching mouse events when a custom button is pressed.
The thing is, I hate toolbars, particularly those in Sierra. So, I decided to implement what I needed as a menu. Basically, I wanted a way to hide/show 2 or more studies at the same time. The region data line right-click show/hide menu in SC is helpful but it only shows/hides one study at a time, and if you are using several to implement shading, etc., then you may have 5 or more that need to all work together. So, this was the reason to explore this option.
The first code block on that page really tells the story. You use a persistent variable, and add a menu item. Do this for as many menu items as you need. Then, you listen for a menu click and if it's the particular one you want, then you perform some action. Here is my code block for the "VWAP RTH" menu item:
I use #define at the top to define CH01_STDY_ZZ as study numbers in my chart that I want to hide or show. You could take these as input variables but I prefer just to put them in the code as it's easy to change if using a #define or variable. So I have
"4" is the study ID of a study I will want to hide or show. In this case it's the RTH VWAP. 2-8 are the ETH VWAP, SD bands, and shading studies. For some reason in the SetStudyVisibilityState(num, state) function, 0 appears to set the study visible and 1 makes it invisible, so I am able to quickly change true and false if SC changes this by using the #define at the top.
As the SC documentation mentions in the 2nd section and as shown in the code block, you need to remove whatever menu items you are not using when the study unloads.
That's it! Just use this to hide/show whatever study you like! If I can answer any questions I'll be happy to. The best thing to do is fire up the CPP editor in Sierra and give it a go. For a single menu item the code shouldn't be more than 30 or 40 lines long, it is very simple, as shown above.