PDA

View Full Version : BackColor in panel 2


ATI user
08-31-2007, 05:40 AM
Hi

I want to set the backcolor in panel 2 based on difference between Volume[0] and Volume[1].

The indicator does not work with the code:
if ( Volume[0] < Volume[1] )....

Do I need to refer to the volume array differently?...or collect the data in a different array?

Thanks

NinjaTrader_Ray
08-31-2007, 06:46 AM
Likely two issues.

1) Set DrawOnPricePanel = false in the Initialize() method. Additional information located here - http://www.ninjatrader-support.com/HelpGuideV6/DrawPriceOnPanel.html

2) Make sure you add as the first statement in OnBarUpdate()

if (CurrentBar < 1)
return;

When you check Volume[1] on the first bar of a chart, 1 bar ago does not yet exist thus the indicator will not work.

ATI user
08-31-2007, 06:52 AM
Thanks Ray.

Works perfectly.

Just adding the second suggestion fixed problem.

ATI user
08-31-2007, 08:22 PM
Ray

Now I want to DrawDot above the volume bar. Does not accept that for some reason. It drew the dot above the price bar until I put in your suggestion #1. Now no dot anywhere.

Thanks

NinjaTrader_Ray
09-01-2007, 09:39 AM
You have to do this by setting the indicator to the same panel as the Volume indicator when adding the indicator to a chart and setting in the indicator itself, set the DrawOnPricePanel property to false.

http://www.ninjatrader-support.com/HelpGuideV6/DrawPriceOnPanel.html