PDA

View Full Version : VWAP - up/down color change


toddaclark
05-04-2009, 02:54 PM
I use the following indicator code on my tradestation 233 tick chart.
[LegacyColorValue = true];
{ VWAP MA }
input:
Price(AvgPrice),length(25),upColor(cyan),dnColor(r ed);
vars:
it(0);
it = VWAP_SMA(Price,length);
plot1(it,"VWAP MA");
if plot1 > plot1[1] then setplotcolor(1,upColor);
if plot1 < plot1[1] then setplotcolor(1,dnColor);

Can someone tell me how to code this in Ninja?

NinjaTrader_Josh
05-04-2009, 03:06 PM
toddaclark,

For color changes please see this: http://www.ninjatrader-support2.com/vb/showthread.php?t=3227

toddaclark
05-04-2009, 03:18 PM
Josh,

Thanks for your reply. I downloaded the indicator that you mentioned in your post.

That indicator seems to use SMA. How can I change it to be VWMA instead of SMA?

Also, how do I get the candles above VWAP to paint blue and the candles below VWAP to paint red?

NinjaTrader_Josh
05-04-2009, 03:23 PM
toddaclark,

The link I referred you to is a reference sample. You can make changes you want to it however you see fit. If you don't want to use SMA just replace it with whatever you do want to use.

You will need to program yourself an indicator that checks the VWAP and then colors the candles. To color the candles you want to use BarColor.

if (some condition)
BarColor = Color.Red;

nkhoi
05-04-2009, 07:35 PM
take a look at the MACDUpDown code to see how to color it
http://www.ninjatrader-support2.com/vb/showthread.php?t=6100

I use the following indicator code on my tradestation 233 tick chart.
[LegacyColorValue = true];
{ VWAP MA }
input:
Price(AvgPrice),length(25),upColor(cyan),dnColor(r ed);
vars:
it(0);
it = VWAP_SMA(Price,length);
plot1(it,"VWAP MA");
if plot1 > plot1[1] then setplotcolor(1,upColor);
if plot1 < plot1[1] then setplotcolor(1,dnColor);

Can someone tell me how to code this in Ninja?

e-man
05-06-2009, 01:24 PM
another idea would be to set some public boolean properties within VWAP (you'd have to recode VWAP to do this) ... and then you could load up a VWAP in your indicator and do what Josh said to color the candles accordingly by accessing those properties

eg. in your new indicator:
if (myVWAP.IsSomething == true) { BarColor = Color.Red; }
elseif (myVWAP.IsSomethingElse == true) { BarColor = Color.Green; }

toddaclark
05-06-2009, 02:07 PM
Thanks for everyone's comments!

Much appreciated!