slope histogram afl

#1
can anyone please help me change for histrogram color, up color green and down color red ploting me this way. <<<<<<<<<<<<<<<<<<< SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor( ParamColor("Color Axes", colorDarkGrey) );
SetChartBkGradientFill( ParamColor("BgTop", colorDarkGrey),ParamColor("BgBottom", colorGrey50)); Periods = Param("Periods", 20, 2, 200, 1, 10 );
Plot( LinRegSlope( C, Periods ), "LinRegSlope("+Periods+")",
colorGreen, styleHistogram | styleThick );

_SECTION_BEGIN("Linear Regression");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( LinearReg( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 
#2
can anyone please help me change for histrogram color, up color green and down color red ploting me this way. <<<<<<<<<<<<<<<<<<< SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor( ParamColor("Color Axes", colorDarkGrey) );
SetChartBkGradientFill( ParamColor("BgTop", colorDarkGrey),ParamColor("BgBottom", colorGrey50)); Periods = Param("Periods", 20, 2, 200, 1, 10 );
Plot( LinRegSlope( C, Periods ), "LinRegSlope("+Periods+")",
colorGreen, styleHistogram | styleThick );

_SECTION_BEGIN("Linear Regression");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( LinearReg( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") );
_SECTION_END();

try the following-

Code:
SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor( ParamColor("Color Axes", colorDarkGrey) ); 
SetChartBkGradientFill( ParamColor("BgTop", colorDarkGrey),ParamColor("BgBottom", colorGrey50)); Periods = Param("Periods", 20, 2, 200, 1, 10 );
lrs=LinRegSlope( C, Periods);
Plot( LinRegSlope( C, Periods ), "LinRegSlope("+Periods+")",
IIf(lrs>0,colorGreen,IIf(lrs<0,colorRed,Null)),styleHistogram | styleThick );

_SECTION_BEGIN("Linear Regression");
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 300, 1, 10 );
Plot( LinearReg( P, Periods ), _DEFAULT_NAME(), ParamColor( "Color", colorCycle ), ParamStyle("Style") ); 
_SECTION_END();
 

Similar threads