PDA

View Full Version : Background Color


BradB
05-02-2007, 01:30 AM
I put together a little indicator that changes the background color (backcolor=) for bars that occur during a specified period of the day, based on parameters. What I would like to do is allow someone to choose their own background color from the Indicators panel, like a normal plotted indicator, but I'm not really doing a plot here. Any suggestions?

NinjaTrader_Dierk
05-02-2007, 01:36 AM
Please try setting up an indicator with one plot and just don't set any value for the plot series. You then should be fine.

NinjaTrader_Ray
05-02-2007, 01:52 AM
Take a look at the source code for VolumeProfile indicator.

Pay attention to the following:

Color variables under the Variables section Color properties under the properties section

- You need to include a property that exposes the color variable

- You need to include a property that serializes the color

scjohn
05-08-2007, 02:17 PM
Some what of a follow up question. I am using BackColorAll and this paints the entire chart. Is there a way of limiting the painting of the background to just the panel that the indicator is running in? If my indicator is running in panel 2, I just want the background area of panel 2 painted. Right now I get panel 1 and 2 painted.

NinjaTrader_Ray
05-08-2007, 02:22 PM
Have you tried the property BackColor ?

See this link - http://www.ninjatrader-support.com/HelpGuideV6/BackColor.html

scjohn
05-09-2007, 07:29 AM
Thanks, That did the trick.

A suggestion: IN the documentation maybe you could cross link property(s) that are similar in nature, like BackColor and BackColorAll.

NinjaTrader_Ray
05-09-2007, 07:39 AM
Thanks for your suggestion.

NinjaTrader_Josh
05-23-2007, 11:45 PM
Does BackColor and BackColorAll only work for indicators? I can't quite seem to get it to paint its colors in my strategy.

NinjaTrader_Dierk
05-24-2007, 02:38 AM
Yes it should.

In case it does not:
- please post simple-as-possible indicator and startegy to demonstrate the problem
- which instrument and time frame did you try?

Thanks

NinjaTrader_Josh
05-24-2007, 04:01 AM
From what you are saying it seems like I need an indicator that utilizes BackColor on my charts for when I run a strategy for it to paint anything. What I was hoping for was to be able to call the BackColor() from within my strategy without having to go to an indicator. I just wanted to paint the bars where my strategy entered and where it exited to make it stand out more.

NinjaTrader_Dierk
05-24-2007, 05:41 AM
Sorry, misunderstanding. Yes BackColor(All) works for strategies as well.

maitreja
11-17-2008, 11:57 AM
Hallo, I'm resolving this:

My main chart for manual trading is NQ. I want to change background of this chart in depence of NYSE TICK, e.g. Tick is > 900, I want to change backcolor to green, TICK is < -900, backcolor has to be red. I have read here that it's not possible to create indicator depending on two different instruments. So I tried to create strategy, but it doesn't work. How to join strategy to chart?
Thanks
maitreja

if(BarsInProgress == 1){
if(Close[0] < -900 ){
BackColorAll = Color.Red;
}
else if(Close[0] > 900){
BackColorAll = Color.Green;
}
}

NinjaTrader_Josh
11-17-2008, 12:05 PM
Hi maitreja,

To add a strategy to a chart you need to first be connected to a data feed.

maitreja
11-17-2008, 12:48 PM
Hi Josh, I'm connected

NinjaTrader_Josh
11-17-2008, 12:52 PM
Press Ctrl+S from your chart to bring up the Strategy selection window. You will then need to add your strategy to the chart.

maitreja
11-17-2008, 01:35 PM
I did it, but it does not work :-(

NinjaTrader_Josh
11-17-2008, 01:39 PM
maitreja,

Let us take a step back. These are the exact steps you need to do to get your strategy onto a chart.

1. Create your strategy and make sure it compiles alright
2. Connect to your data provider
3. Open a chart that has data on it
4. Ctrl+S to bring up the Strategy selection window
5. Select your strategy from the left hand side and then press the "New" button
6. Change your strategy parameters on the right hand side.
7. Press Apply
8. Press OK
9. Your strategy will be on your chart now. If your strategy has any errors it will appear in the Control Center logs.

maitreja
11-17-2008, 01:52 PM
I did it. I tried to attach screenshot. Strategy is running, it is writing into console what I want, I'm connected......

I dont know how to say it in English, but in czech looks like very zapeklitý problem :-)

maitreja
11-17-2008, 02:01 PM
second attempt, it was to big

NinjaTrader_Josh
11-17-2008, 02:04 PM
Great, it looks like you have it working now. If you have other questions feel free to post them on the forums. Have a good day!

maitreja
11-18-2008, 09:41 AM
Hi Josh, I know, it looks fine, but background color is not changing.
Can you try my code in your NT?

NinjaTrader_Josh
11-18-2008, 10:03 AM
Test your code in BarsInProgress 0.

maitreja
11-18-2008, 10:10 AM
It works fine

NinjaTrader_Josh
11-18-2008, 10:13 AM
You are charting the NQ but you are trying to change colors for the TICK. That will not work. Instead just program from within the BarsInProgress = 0 context. To access the close value of the tick you can use Closes[1][0].

if (BarsInProgress == 0)
{
if (Closes[1][0] > 0)
BackColorAll = Color.Red;
}

maitreja
11-18-2008, 10:31 AM
Now it works fine, thank you
maitreja

maitreja
11-18-2008, 10:49 AM
So one more question - is it possible to do color will change in this case:
I'm using 5 min TF NQ and 1 min TF Tick. If Tick is under or above some value, background color will change immediatly via Tick during drawing 5TF bar? It means online changing for example 3 times on one bar?

NinjaTrader_Josh
11-18-2008, 10:57 AM
That is no different than what you already have. Just run on CalculateOnBarClose = false.