NexusFi: Find Your Edge


Home Menu

 





Add Background Color function to an indicator


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one michaelf with 12 posts (2 thanks)
    2. looks_two redratsal with 8 posts (12 thanks)
    3. looks_3 Fat Tails with 7 posts (19 thanks)
    4. looks_4 Mindset with 3 posts (0 thanks)
    1. trending_up 20,255 views
    2. thumb_up 33 thanks given
    3. group 7 followers
    1. forum 33 posts
    2. attach_file 11 attachments




 
Search this Thread

Add Background Color function to an indicator

  #1 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,434
Thanks Received: 581

I don't have any programer experience, but i would like to add an background color function to all my indicators, like the one on the MACDBBLinesV4. Simple panel background color change when indicator changes direction.
Question: is it very difficult, specialy for me, to make this add to the indicators?

thanks for answers

michael

Attached Thumbnails
Click image for larger version

Name:	eurusd.JPG
Views:	362
Size:	171.9 KB
ID:	42328  
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Are there any eval firms that allow you to sink to your …
Traders Hideout
Futures True Range Report
The Elite Circle
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Build trailing stop for micro index(s)
Psychology and Money Management
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
60 thanks
Funded Trader platforms
37 thanks
NexusFi site changelog and issues/problem reporting
24 thanks
GFIs1 1 DAX trade per day journal
22 thanks
The Program
19 thanks
  #3 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102



michaelf View Post
I don't have any programer experience, but i would like to add an background color function to all my indicators, like the one on the MACDBBLinesV4. Simple panel background color change when indicator changes direction.
Question: is it very difficult, specialy for me, to make this add to the indicators?

thanks for answers

michael

It is not difficult to add this to any indicator. You will need to

(1) declare color variables in the Variables section of the indicator, something like

 
Code
private Color upColor = Color.LimeGreen;
private Color downColor = Color.Red;
private int opacity = 5;
(2) introduce a condition specifiying when your background shall be painted at the end of the OnBarUpdate() section, for example

 
Code
int alpha =  25 * opacity;
if (Value[0]>Value[1]) // rising indicator value
      BackColor = Color.FromArgb(alpha, upColor)
else // falling indicator value
      BackColor = Color.FromArgb(alpha, downColor)
If you use BackColorAll instead of BackColor, all panels of the chart will be colored, with BackColor only the indicator panel will be colored.

(3) If you want the colors to be user selectable you need to serialize the colors. You should define a property for the opacity. This can be done in the Properties Section of the indicator. Best copy the code from another indicator and just change the variables. Opacity should be a value between 0 and 10, so you would declare it as:

 
Code
  /// <summary>
        /// </summary>
        [Description("Opacity of Background ")]
        [GridCategory("Plots")]
        [Gui.Design.DisplayNameAttribute("Background Opacity")]
        public int Opacity
        {
            get { return opacity; }
            set { opacity = Math.Min(10, Math.Max(0, value)); }
        }

Reply With Quote
  #4 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090

If you want a readymade recipe this thread is about it

Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,434
Thanks Received: 581

Thank you Fat Tails for you reply

I want only that the indicator panel to be colored and I thought the same that I need to take first look on a existend indicator. I will to try it first with a Stochastic, because the WMA_colors indicator I use, yeah, I think with that one it will be to much.

Thanks again

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #6 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,434
Thanks Received: 581

redratsal thank you for you reply

I like the idea of bigmike's (thread 30) design, but it will be very hurtfurlly for me, every time when my wife will see this she will hit me on the head.

Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090


michaelf View Post
redratsal thank you for you reply

I like the idea of bigmike's (thread 30) design, but it will be very hurtfurlly for me, every time when my wife will see this she will hit me on the head.


Visit my NexusFi Trade Journal Reply With Quote
  #8 (permalink)
 
michaelf's Avatar
 michaelf 
Mérida, Mexico
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8
Broker: NinjaTrader Brokerage
Trading: MNQ
Frequency: Daily
Duration: Minutes
Posts: 559 since Mar 2011
Thanks Given: 1,434
Thanks Received: 581

HELP

I tried now everything but without success, it is to difficult for me.
Maybe someone out there can write a script for me. I wish to have a simple Stochastics with panel background color on the PeriodD and PeriodK crossover.
I maked a screenshot of an example, only on this indicator the Period D linie change it color when it changes direction and I would wish when D and K makes a crossover.

Hopefully some one can help me I would really appreciated it.

Thanks a lot
Michael

Attached Thumbnails
Click image for larger version

Name:	eurusd.JPG
Views:	333
Size:	47.3 KB
ID:	42373  
Follow me on Twitter Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #9 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090

it's elite post #2637

Visit my NexusFi Trade Journal Reply With Quote
  #10 (permalink)
 
redratsal's Avatar
 redratsal 
Milan (I)
 
Experience: Advanced
Platform: Ninjatrader
Broker: Kinetick
Trading: FDAX,6E,CL,YM,NQ,ES
Posts: 1,648 since Oct 2010
Thanks Given: 1,215
Thanks Received: 2,090


you are lucky same but not elite

consider beeing elite you get a lot more...

Visit my NexusFi Trade Journal Reply With Quote




Last Updated on October 15, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts