NexusFi: Find Your Edge


Home Menu

 





Change color of indicator line


Discussion in NinjaTrader

Updated
    1. trending_up 1,122 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?
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Ninjatrader users - good CONNECTIONs post and article fr …
NinjaTrader
Fabrication or Framework? Irans Denied MOU Explains the …
Prediction Markets & Event Contracts
Trump Lands in Beijing on CPI Day: Iran Peace Expires To …
Prediction Markets & Event Contracts
Peace Deal Forward Curve: May 22%, June 51%, December 81 …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
8 thanks
Darmok and Jalad at Tanagra
1 thanks
  #2 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,581 since Oct 2009
Thanks Given: 4,267
Thanks Received: 6,208


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