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)
ADDING OPACITY CONTROL AS A PARAMETER FOR AN INDICATOR
I created a simple indicator that backpaints on the chart; I was able to add opacity control to it, but need to know how to add the parameter so it will show up when the indicator is open, and you can then adjust the opacity on a scale from 0-100? Can someone point me in the right direction. I am beginning to learn how to code, and could use some help. Thanks in advance.
At the Class level... I.e., where you add global variables, add an int for you opacity like so...
Here, I'm adding an arbitrary rectangle, starting 5 bars ago, to the current bar, with a height of the CURRENT bars range. This would probably be somewhere in your OnBarUpdate() block. Note I've added the opacity variable we created into the Draw.Rectangle() method.
Finally, to turn this variable into a user input, in the parameter section below the OnBarUpdate(), we add our UserInput defintion, like so:
Note above, you can add a Name of whatever you want, and that will be what the user input sees(here, the user we see Box Opacity(0-99) in the user input). Note the different capitalizations of the variable name, "myOpacity."
Also of note... if you ever struggle to create these things from scratch, or struggle to find these things in the documentation... you can always create a dummy indicator, using the builder tool, create the type of user input you need... and just copy the created code into the indicator you are working on.