Tradestation question

How do you get a Weighted Moving Average to change color say to green on upward trend and red on downward trend. I will be using tick charts and the 240 WMA will not display properly. I know its probably a very easy answer for some of the viewers but I would appreciate any and all help.


Thanks in advance,


Packman
 
Code:
inputs:
	Price( Close ),
	Length( 9 ),
	Displace( 0 ),
	upcol( green),
	dncol( red );

variables:
	WMA( 0 ) ;

condition1 = Displace >= 0 or CurrentBar > AbsValue( Displace ) ;
if condition1 then 
	begin
	WMA = WAverage( Price, Length ) ;
	
	if WMA > WMA[1] then SetPlotColor(1, upcol) else
	if WMA < WMA[1] then SetPlotColor(1, dncol);
	 
	Plot1[Displace]( WMA, "AvgWtd" ) ;

	                  
	if Displace <= 0 then 
		begin
		condition1 = Price > WMA and WMA > WMA[1] and WMA[1] <= WMA[2] ;
		if condition1 then
			Alert( "Indicator turning up" ) 
		else 
		begin
		condition1 = Price < WMA and WMA < WMA[1] and WMA[1] >= WMA[2] ; 
		if condition1 then
			Alert( "Indicator turning down" ) ;
		end ;
		end;
	end ;
 
Try the Gauss indicator. A WMA30 equals a Gauss48, so I found. And the Gauss changes colors up and down.

Happy trading, Felix
 
Back
Top