Need help to create this

rg = (Hi - Lo);
bp = (Hi + Lo + C1)/3; bpI = LastValue (bp,1);
r1 = (bp2)-Lo; r1I = LastValue (r1,1);
s1 = (bp
2)-Hi; s1I = LastValue (s1,1);
r2 = bp + r1 - s1; r2I = LastValue (r2,1);
s2 = bp - r1 + s1; s2I = LastValue (s2,1);
r3 = bp + r2 - s1; r3I = LastValue (r3,1);
s3 = bp - r2 + s1; s3I = LastValue (s3,1);
r4 = bp + r2 - s2; r4I = LastValue (r4,1);
s4 = bp - r2 + s2; s4I = LastValue (s4,1);

need to make buy ,sell,short and cover condition

buy when price cross above pivot(bp) ,sell at r1 ,SL 20 points

short when price cross below bp,cover at s1,SL 20ponts

Pivots can not be plotted in tradescript

Pivots in AFL Reffer below

_SECTION_BEGIN("Pivot Identifier");
 SetChartOptions(0,chartShowArrows|chartShowDates);
 _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
 Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

 dist = 0.5*ATR(10);
 //code and plot the pivot top
 PivotTop = L < Ref(L,-1) AND H < Ref(H,-1) AND Ref(L,-1) < Ref(L,-2) AND Ref(H,-1) < Ref(H,-2) AND Ref(H,-2) > Ref(H,-3) AND Ref(L,-2) > Ref(L,-3);
 PivotBottom = H > Ref(H,-1) AND L > Ref(L,-1) AND
 Ref(H,-1) > Ref(H,-2) AND Ref(L,-1) > Ref(L,-2) AND
 Ref(L,-2) < Ref(L,-3) AND Ref(H,-2) < Ref(H,-3);
 for( i = 0; i < BarCount; i++ ) 
 { 
 if( PivotTop [i] ) PlotText( "PVT", i-2, H[ i-2 ], colorGreen ); 
 if( PivotBottom [i] ) PlotText( "PVB", i-2, L[ i-2 ] - dist[i] , colorRed );
 }
 _SECTION_END();

Do you want it in AFL or Tradescript. ? Can you explain your condition?