I NEED HELP
CHANGE BACKGROUND COLOR TO GREEN IF BUY ELSE RED
_SECTION_BEGIN("PERFECT TRADE");
SetBarsRequired(200,0);
GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,13,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
j=Haclose;
//============== MA CONDITION ==============
a=20;
GraphXSpace=5;
p=30;
p = Param("p",30,2,100,1);
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
X=HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
X=Color20= IIf(LinRegSlope(MA(HaClose,a),slope)< 0,colorRed,colorBlue);
Y=Plot(MA(HaClose,a),"", color20,styleThick);
Color=IIf(Haclose>MA(HaClose,a),colorBlue, colorRed);
_SECTION_END();
/************************************************************
BUY SELL INDICATOR
*************************************************************/
//PlotDT();
icol = IIf(LinRegSlope(MA(HaClose,a),slope)< 0,colorRed,colorBlue);
Plot(MA(HaClose,a),"", color20,styleThick);
Buy = (LinRegSlope(MA(HaClose,a),slope)> 0);
Sell = (LinRegSlope(MA(HaClose,a),slope)< 0);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorWhite, 0, L, Offset=-70);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorWhite, 0,L, Offset=-60);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBlue, 0,L, Offset=-65);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorYellow, 0, H, Offset=60);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorYellow, 0,H, Offset=70);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-65);
_SECTION_END();
CHANGE BACKGROUND COLOR TO GREEN IF BUY ELSE RED
_SECTION_BEGIN("PERFECT TRADE");
SetBarsRequired(200,0);
GraphXSpace = 5;
SetChartOptions(0,chartShowArrows|chartShowDates);
k = Optimize("K",Param("K",1,0.25,5,0.25),0.25,5,0.25);
Per= Optimize("atr",Param("atr",4,13,20,1),3,20,1);
HACLOSE=(O+H+L+C)/4;
HaOpen = AMA( Ref( HaClose, -1 ), 0.5 );
HaHigh = Max( H, Max( HaClose, HaOpen ) );
HaLow = Min( L, Min( HaClose, HaOpen ) );
PlotOHLC( HaOpen, HaHigh, HaLow, HaClose, "" + Name(), colorWhite, styleCandle | styleNoLabel );
j=Haclose;
//============== MA CONDITION ==============
a=20;
GraphXSpace=5;
p=30;
p = Param("p",30,2,100,1);
Om=DEMA(O,p);
hm=DEMA(H,p);
lm=DEMA(L,p);
Cm=DEMA(C,p);
X=HACLOSE=(Om+Hm+Lm+Cm)/4;
HaOpen = AMA( Ref( HaClose, -1), 1);
HaHigh = Max( Hm, Max( HaClose, HaOpen ) );
HaLow = Min( Lm, Min( HaClose, HaOpen ) );
slope = Param("slope",2,2,100,1);
X=Color20= IIf(LinRegSlope(MA(HaClose,a),slope)< 0,colorRed,colorBlue);
Y=Plot(MA(HaClose,a),"", color20,styleThick);
Color=IIf(Haclose>MA(HaClose,a),colorBlue, colorRed);
_SECTION_END();
/************************************************************
BUY SELL INDICATOR
*************************************************************/
//PlotDT();
icol = IIf(LinRegSlope(MA(HaClose,a),slope)< 0,colorRed,colorBlue);
Plot(MA(HaClose,a),"", color20,styleThick);
Buy = (LinRegSlope(MA(HaClose,a),slope)> 0);
Sell = (LinRegSlope(MA(HaClose,a),slope)< 0);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorWhite, 0, L, Offset=-70);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorWhite, 0,L, Offset=-60);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBlue, 0,L, Offset=-65);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorYellow, 0, H, Offset=60);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorYellow, 0,H, Offset=70);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-65);
_SECTION_END();