ADDING OPACITY CONTROL AS A PARAMETER FOR AN INDICATOR - futures io
futures io



ADDING OPACITY CONTROL AS A PARAMETER FOR AN INDICATOR


Discussion in NinjaTrader

Updated
    1. trending_up 485 views
    2. thumb_up 3 thanks given
    3. group 1 followers
    1. forum 1 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • 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 and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

ADDING OPACITY CONTROL AS A PARAMETER FOR AN INDICATOR

(login for full post details)
  #1 (permalink)
 Bullywig 
Chicago
 
Experience: Intermediate
Platform: NinjaTrader
Broker: NinjaTrader Brokerage
Trading: FDAX, NQ, HG, SI, CL
 
Bullywig's Avatar
 
Posts: 55 since Oct 2015
Thanks: 32 given, 17 received

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.

Started this thread Reply With Quote
The following user says Thank You to Bullywig for this post:

Journal Challenge April 2021 results:
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(620 thanks from 61 posts)
looks_twoSalao's Journalby Salao
(162 thanks from 29 posts)
looks_3Learning to Profit - A journey in algorithms and optionsby Syntax
(115 thanks from 27 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(94 thanks from 30 posts)
looks_5Maybe a little bit different journalby Malykubo
(53 thanks from 32 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
I finally blew up an account
124 thanks
The Crude Dude Oil Trading System
85 thanks
Spoo-nalysis ES e-mini futures S&P 500
65 thanks
The tiyfTradePlanFactory indicator
31 thanks
Building a Crypto Mining Rig
19 thanks
 
(login for full post details)
  #2 (permalink)
 forrestang 
Urban Samurai
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
 
forrestang's Avatar
 
Posts: 1,239 since Jun 2010
Thanks: 306 given, 950 received

At the Class level... I.e., where you add global variables, add an int for you opacity like so...

 
Code
	public class NameOfIndicator: Indicator
	{
             private int myOpacity = 50;
	........


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.

 
Code
Draw.Rectangle(this, "tag1", false, 5, Low[0], 0, High[0], Brushes.PaleGreen, Brushes.PaleGreen, myOpacity );

Finally, to turn this variable into a user input, in the parameter section below the OnBarUpdate(), we add our UserInput defintion, like so:
 
Code
[Range(0, int.MaxValue)]
[Display(ResourceType = typeof(Custom.Resource), Name = "Box Opacity(0-99)", Description = "", GroupName = "Parameters", Order = 1)]
public int MyOpacity 
{	
            get { return myOpacity ; }
            set { myOpacity = value; }
}
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.

Reply With Quote
The following 2 users say Thank You to forrestang for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > ADDING OPACITY CONTROL AS A PARAMETER FOR AN INDICATOR


Last Updated on March 31, 2021


Upcoming Webinars and Events

NinjaTrader Indicator Challenge!

Ongoing

Journal Challenge w/$1,800 in prizes!

May 7

The Cold Hard Truth: Maybe I Am Not Good Enough w/Chris Gray @ Earn2Trade

Elite only
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts