NinjaTrader Support Forum  

Go Back   NinjaTrader Support Forum > NinjaScript Development Support > Strategy Development

Strategy Development Support for the development of custom automated trading strategies using NinjaScript.

Reply
 
Thread Tools Display Modes
Old 11-09-2010, 12:26 PM   #1
paulca
Member
 
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
Default StrategyPlot() color change

I'm trying to change a StrategyPlot color dynamically in OnBarUpdate(), eg:

OnBarUpdate()
{
if (somecondition)
StrategyPlot(0).Plots[0].Pen.Color = Color.Red;
else
StragegyPlot(0).Plots[0].Pen.Color = Color.Green;
}

This doesn't work. Someone else recently asked this question and he was given a link to sample code to change plot colors in an indicator, not a strategy.

Thxs,

Paul
'
paulca is offline  
Reply With Quote
Old 11-09-2010, 12:39 PM   #2
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

First off are you using NinjaTrader 7 or NinjaTrader 6.5 as you need to use a different method depending on what version you are on.

I look forward to assisting you further.
NinjaTrader_Brett is offline  
Reply With Quote
Old 11-09-2010, 12:45 PM   #3
paulca
Member
 
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
Default

Sorry Brett - 7.0.0.23. I thought that StrategyPlot() was only available in 7.0.

Paul
paulca is offline  
Reply With Quote
Old 11-09-2010, 12:47 PM   #4
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

In 7 you will want to use the following sample to do this:

http://www.ninjatrader.com/support/f...t=21225&page=5

Please see post number 1.

Let me know if I can be of further assistance.
NinjaTrader_Brett is offline  
Reply With Quote
Old 11-09-2010, 12:57 PM   #5
paulca
Member
 
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
Default

That sample shows how to change a plot color in an indicator. In a strategy "PlotColors" does not exist.
paulca is offline  
Reply With Quote
Old 11-09-2010, 02:12 PM   #6
NinjaTrader_Brett
NinjaTrader Customer Service
 
NinjaTrader_Brett's Avatar
 
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
Default

Hello,

Ah understood.

SMA(20).PlotColors[0][0] = Color.Black;

Tested this on my side and this compiles for me.
NinjaTrader_Brett is offline  
Reply With Quote
Reply

Tags
strategyplot change color

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
StrategyPlot Pen Color gg80108 Strategy Development 3 10-28-2010 09:49 AM
Change chart panel back color and bar color for a previous bar. ackchan General Programming 5 03-09-2010 08:44 AM
I can not change the bar color. nkhoi General Programming 16 09-08-2009 12:19 PM
Background Color Change laocoon Indicator Development 2 06-15-2009 07:23 AM
How to change color of a trendline? dario Charting 1 11-21-2008 05:39 AM


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