![]() |
|
|||||||
| Strategy Development Support for the development of custom automated trading strategies using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Member
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
|
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 ' |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
|
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.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Member
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
|
Sorry Brett - 7.0.0.23. I thought that StrategyPlot() was only available in 7.0.
Paul |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
|
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.
Brett
NinjaTrader Customer Service |
|
|
|
|
|
#5 |
|
Member
Join Date: Apr 2010
Posts: 66
Thanks: 2
Thanked 0 times in 0 posts
|
That sample shows how to change a plot color in an indicator. In a strategy "PlotColors" does not exist.
|
|
|
|
|
|
#6 |
|
NinjaTrader Customer Service
Join Date: Dec 2009
Location: Denver, CO, USA
Posts: 6,499
Thanks: 109
Thanked 291 times in 280 posts
|
Hello,
Ah understood. SMA(20).PlotColors[0][0] = Color.Black; Tested this on my side and this compiles for me.
Brett
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| strategyplot change color |
| Thread Tools | |
| Display Modes | |
|
|
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 |