[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Coding help for color?



PureBytes Links

Trading Reference Links

I have been trying to plot a moving average where if it is going up it is one color and if it is going down it's a different color. I've done it a couple of different ways but not receiving the desired effect.  One of the ways is listed below but it lags one bar in color.  Can someone please help with the correct method.
Thanks 
Randy

inputs: Price( Close ), Length( 9 );
Vars: AverageFCColor(White); 
AverageFCColor = Red;
If AverageFC(Price, Length) > AverageFC(Price, Length)[1] then
AverageFCColor = White;
Plot1( AverageFC( Price, Length ), "Avg",AverageFCColor ) ;