NexusFi: Find Your Edge


Home Menu

 





Change color of indicator line


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 Gaterz 
Las Vegas, Nevada
 
Experience: Intermediate
Platform: TOS, NinjaTrader
Trading: Stocks, Futuers, Options
Posts: 18 since Apr 2014
Thanks Given: 0
Thanks Received: 0

How do I code an existing indicator, RSI, so that the line changes color based on whether it is positive or negative?

I copied the code but didn't know where to paste it into the editor. After some research, I'm thinking I would use the Brush to have the color change but have no idea.

Ninjascript seems way too much. For reference, I'm able to make changes in thinkorswim which seems way easier but I'm not using TOS for futures...


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
$134M Ground Entry Contract in Disputed Final Review Aft …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
Beijing Summit Closes: Xi Pledges Hormuz Help -- $1.14B …
Prediction Markets & Event Contracts
UCL Final Kicks Off at Noon ET: PSG at 56.5% as Iran May …
Prediction Markets & Event Contracts
CFTC Advances Prediction Markets Regulation -- Chairman …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
22 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
5 thanks
  #2 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,580 since Oct 2009
Thanks Given: 4,266
Thanks Received: 6,199


Gaterz View Post
How do I code an existing indicator, RSI, so that the line changes color based on whether it is positive or negative?

I copied the code but didn't know where to paste it into the editor. After some research, I'm thinking I would use the Brush to have the color change but have no idea.

Ninjascript seems way too much. For reference, I'm able to make changes in thinkorswim which seems way easier but I'm not using TOS for futures...

I would use the slope and place it in the OnBarUpdate method:
https://ninjatrader.com/support/helpGuides/nt8/NT%20HelpGuide%20English.html?slope.htm

If angle > x then change the color to x else change the color to y


Reply With Quote
  #3 (permalink)
 SamirOfSalem   is a Vendor
 
Posts: 77 since Jan 2020
Thanks Given: 23
Thanks Received: 49



Gaterz View Post
How do I code an existing indicator, RSI, so that the line changes color based on whether it is positive or negative?

I copied the code but didn't know where to paste it into the editor. After some research, I'm thinking I would use the Brush to have the color change but have no idea.

Ninjascript seems way too much. For reference, I'm able to make changes in thinkorswim which seems way easier but I'm not using TOS for futures...

The values plotted are always positive, so consider using a combination of IsRising() and IsFaling().

Drag the attached file into the Indicators folder and compile. Or simply add the sample code highligted in red below:

 
Code
			double avgDown0	= avgDown[0];
			double value0	= avgDown0 == 0 ? 100 : 100 - 100 / (1 + avgUp[0] / avgDown0);
			Default[0]		= value0;
			Avg[0]			= constant1 * value0 + constant2 * Avg[1];



			//-------------------------------------------
			if (IsRising(Default))
				PlotBrushes[0][0] = Brushes.Green;
			else
				PlotBrushes[0][0] = Brushes.Red;

			if (IsRising(Avg))
				PlotBrushes[1][0] = Brushes.Lime;
			else
				PlotBrushes[1][0] = Brushes.Pink;
			//-----------------



		}


Attached Files
Elite Membership required to download: RSI_modified.cs
Reply With Quote




Last Updated on March 22, 2023


© 2026 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 - Downloads - Top
no new posts