NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > General Programming

General Programming General NinjaScript programming questions.

Reply
 
Thread Tools Display Modes
Old 01-23-2010, 09:49 AM   #1
ackchan
Junior Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Cool Change chart panel back color and bar color for a previous bar.

I can't find a way to change the chart panel color for a previous bar on a custom indicator I developed. I know the Backcolor = Color.Salmon; command changes the color of the current bar to Salmon but is there a way to do this for a previous bar?

Similarly is there a way to change the colour of a previous bar on the chart panel. I know the Barcolor =Color.Salmon can only change the color of the current bar.

Appreciate any help.
ackchan is offline  
Reply With Quote
Old 01-23-2010, 10:24 AM   #2
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

Please go here:
http://www.ninjatrader-support.com/H...BackColor.html

...and copy and paste in the example section.
NinjaTrader_Ben is offline  
Reply With Quote
Old 01-24-2010, 09:47 PM   #3
ackchan
Junior Member
 
Join Date: Jan 2010
Posts: 4
Thanks: 0
Thanked 0 times in 0 posts
Default

I looked at the link posted. I guess that means that it's not possible to change for a previous bar then, only possible for the current bar? Actually what I want to do is to make known visibly in a chart, the previous bar selected by the NinjaTrader Swing().SwingHigh() function. Is there a way to do this?
ackchan is offline  
Reply With Quote
Old 01-24-2010, 10:55 PM   #4
NinjaTrader_Ben
NinjaTrader Customer Service
 
NinjaTrader_Ben's Avatar
 
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
Default

Hello,

The swing indicator won't work for this very well. Its values change retroactively. It takes a bit more programming to make that work.
NinjaTrader_Ben is offline  
Reply With Quote
Old 03-09-2010, 06:28 AM   #5
poseidon_sthlm
Senior Member
 
Join Date: Aug 2009
Posts: 153
Thanks: 11
Thanked 5 times in 4 posts
Question How to backcolor of the previous bar in a strategy

Hi!
I want to backcolor the previous bar in a strategy.

Code:
if (true)
  {
       set the backcolor of the previous bar to lime green
  }
How can I do this?

Since there isn't any bars_ago option in the Backcolor property, I'v tried to use the DrawRegion() method, But it don't woks the way I hoped.
Code:
_zero.Set(0);

if (true)
   {
        DrawRegion("Mytag" + CurrentBar, CurrentBar-1, CurrentBar, _zero, 100000, Color.Empty, Color.Lime, 1);
   }
(This doesn't paint at all and there is no error message.)

Do you have any suggestion how I can backcolor the previous bar?
Last edited by poseidon_sthlm; 03-09-2010 at 08:03 AM.
poseidon_sthlm is offline  
Reply With Quote
Old 03-09-2010, 09:44 AM   #6
NinjaTrader_Bertrand
NinjaTrader Customer Service
 
NinjaTrader_Bertrand's Avatar
 
Join Date: Sep 2008
Location: Germany
Posts: 24,548
Thanks: 386
Thanked 1,397 times in 1,366 posts
Default

Have you tried something like this snippet below?

Code:
 
if (CurrentBar < 1) return;
 
DrawRegion("Region1", 1, 0, Low, High[1], Color.Black, Color.Blue, 5);
Correct is the BackColor call is for the current bar only, so this might provide a workaround.

For an unsupported method you could check into the CandleStickPattern indicator and how it visualizes the found patterns.
NinjaTrader_Bertrand is online now  
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bar/Candle color change with HMA slope??? MiniDowTrader Charting 3 10-17-2012 09:00 AM
Get the plot/color of the of the previous bar? Ninja B General Programming 3 01-23-2011 11:51 PM
I can not change the bar color. nkhoi General Programming 16 09-08-2009 12:19 PM
Referencing the Color of a Previous Bar jfalbert19 Indicator Development 2 02-17-2009 05:02 PM
how to change the color of a specific candlestick bar clearpicks Charting 1 08-01-2008 02:24 PM


All times are GMT -6. The time now is 06:18 AM.