NexusFi: Find Your Edge


Home Menu

 





BollingerBandWidth indicator with up and down colors


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one RMorgan with 2 posts (0 thanks)
    2. looks_two pintope with 2 posts (2 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 KrazyTrader with 1 posts (1 thanks)
    1. trending_up 1,809 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

BollingerBandWidth indicator with up and down colors

  #1 (permalink)
 RMorgan 
Denver, CO USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Futures (TF, YM)
Posts: 15 since Aug 2011
Thanks Given: 24
Thanks Received: 38

I'm struggling with trying to modify the BollingerBandWidth indicator to plot green when it's going up and red when it's going down. This admittedly my first time trying to modify an indicator and I have no background in programming.

Any help could be greatly appreciated.

This is the original indicator:

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
REcommedations for programming help
Sierra Chart
Trade idea based off three indicators.
Traders Hideout
How to apply profiles
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
33 thanks
Just another trading journal: PA, Wyckoff & Trends
28 thanks
Bigger Wins or Fewer Losses?
23 thanks
Tao te Trade: way of the WLD
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 RMorgan 
Denver, CO USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: Futures (TF, YM)
Posts: 15 since Aug 2011
Thanks Given: 24
Thanks Received: 38


I think I found something that will work instead. I'll just do a EMA of 1 and then plot red/green based on the last value. Thanks anyway - I hope nobody wasted too much time.

Started this thread Reply With Quote
  #4 (permalink)
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9

Try this from Fat Tails.

Reply With Quote
Thanked by:
  #5 (permalink)
 
pintope's Avatar
 pintope 
Madrid, Spain
 
Experience: Beginner
Platform: NinjaTrader + Dendric
Broker: IB/Kinetick
Trading: Futures
Posts: 17 since May 2014
Thanks Given: 5
Thanks Received: 9

Hello @RMorgan,

Anyway I’ll waste a little time. You add the indicators in the Initialize() method:
protected override void Initialize()
{
Add(ATR(ATRPeriod));
Add(EMA(EMAPeriod));
Add(Bollinger(numStdDev, BPeriod));

}
In order to set colours, you reference indicators by “this.Indicators” collection in the same order you added them. If the indicator has several lines, you reference them by “this.Indicators[N].Plots” collection. Have a look:
this.Indicators[0].Plots[0].Pen.Color = Color.FromArgb(R, G, B); // ATR
this.Indicators[1].Plots[0].Pen.Color = Color.FromArgb(R, G, B); // EMA
this.Indicators[2].Plots[0].Pen.Color = Color.FromArgb(R, G, B); // Bollinger 1
this.Indicators[2].Plots[1].Pen.Color = Color.FromArgb(R, G, B); // Bollinger 2
this.Indicators[2].Plots[2].Pen.Color = Color.FromArgb(R, G, B); // Bollinger 3
I’m not sure but I think “this.Indicators[2].Plots[0]” corresponds to middle Bollinger band, “this.Indicators[2].Plots[1]” to upper band and ““this.Indicators[2].Plots[2]” to lower band.

Follow me on Twitter Reply With Quote
Thanked by:
  #6 (permalink)
 
pintope's Avatar
 pintope 
Madrid, Spain
 
Experience: Beginner
Platform: NinjaTrader + Dendric
Broker: IB/Kinetick
Trading: Futures
Posts: 17 since May 2014
Thanks Given: 5
Thanks Received: 9

I should also like to add that the “decoration” can take place in the indicator itself or in the strategy. In the former case you have to change the indicator code, so you have to create and maintain a new version (or several). In the latter case you do it in the strategy.

It depends on the circumstances, in both cases you add one or two lines of code. I tend to decorate in the strategy, it’s more flexible.

Follow me on Twitter Reply With Quote
Thanked by:




Last Updated on November 18, 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