How to add Buy, Sell,Short, Cover for Algo trading

Hi,how to add Buy, Sell,Short, Cover command for Algo trading to this AFL
any one help me.Thing is Buy side is taking but for short side its not.
Please help me.

_SECTION_BEGIN("MA Crossover Unicolor");

Plot(EMA(Close,3),"3-EMA",colorYellow,1);
Plot(EMA(Close,5),"5-EMA",colorBlue,4);

r=EMA(C,3);
a=EMA(C,5);

no=Param( "Swing", 5, 1, 55 );

res=HHV(H,no);
sup=LLV(L,no);
tsl=IIf(ValueWhen(IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0))!=0,IIf(C>Ref(res,-1),1,IIf(C<Ref(sup,-1),-1,0)),1)==1,sup,res);

Plot(tsl, _DEFAULT_NAME(), colorYellow, styleStaircase);
Buy = Cross(C,res) ;
Sell = Cross(sup,C) ;
//PlotShapes (IIf(Buy,shapeUpArrow,shapeNone),colorYellow,0,Graph0,-15);
//PlotShapes (IIf(Sell,shapeDownArrow,shapeNone),colorCustom12,0,Graph0,-15);

_SECTION_END();

//GfxDrawText("5 period high low system", 4,12, 250, 40);

_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);

Plot( C, "Close", IIf(r>a,colorGreen,IIf(a>=r,colorRed,colorWhite)), styleCandle | styleThick );
_SECTION_END();
a=C;
g=(EMA(Close,3) * (2 / 4 - 1)-EMA(Close,5) * (2 / 6 - 1)) / (2 /4- 2 /6);
e=Ref(tsl,-1);
Buy = Cross(C,tsl) ;
Sell = Cross(tsl,C) ;
SellPrice=ValueWhen(Sell,e,1);
BuyPrice=ValueWhen(Buy,e,1);
Long=Flip(Buy,Sell);
Shrt=Flip(Sell,Buy );
Filter=Buy OR Sell;
Buy = Cross(C,tsl) ;
Sell = Cross(tsl,C) ;
shape = Buy * shapeUpArrow + Sell * shapeDownArrow;

PlotShapes( shape, IIf( Buy, colorGreen, colorRed ),0, IIf( Buy, Low, High ) );
a1=Ref(tsl,-1);
GraphXSpace = 5;
dist = 1.5*ATR(5);
for( i = 0; i < BarCount; i++ )
{if( Buy[i] ) PlotText( "Buy\n@" + a1[ i ], i, L[ i ]-dist[i], colorGreen );
if( Sell[i] ) PlotText( "Sell\n@" + a1[ i ], i, H[ i ]+dist[i],
colorRed);
}

GraphXSpace = 5;
dist = 2.5ATR(5);
for( i = 0; i < BarCount; i++ )
{if( Buy[i] ) PlotText( "Stop\n@" + tsl[ i ], i, L[ i ]-dist[i], colorRed );
if( Sell[i] ) PlotText( "Stop\n@" + tsl[ i ], i, H[ i ]+dist[i],
colorGreen);
}
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
AddColumn(C,"close",1.2);
AddColumn(e,"trade price",1.2);
gd=(Ref(EMA(C,5),-1)
(1-.3333)-Ref(EMA(C,3),-1)*(1-.5))/(.5-.3333);
zd=(EMA(Close,3) * (2 / 4 - 1) - EMA(Close,5) * (2 / 6 - 1)) / (2 / 4 -2 /6);
Cond0=EMA(C,3)>EMA(C,5);
NR7 = (Ref(H,-1) - Ref(L,-1)) < Ref(LLV(H-L,7),-1);
V1=V;
V2=Ref(V,-1);

WriteIf (Buy , " GO LONG / Reverse Signal at "+e+" ","")+
WriteIf (Sell , " EXIT LONG / Reverse Signal at "+e+" ","")+"\n"+EncodeColor(colorRed)+
WriteIf(Sell , "Total Profit/Loss for the Last Trade Rs."+(C-BuyPrice)+"","")+
WriteIf(Buy , "Total Profit/Loss for the Last trade Rs."+(SellPrice-C)+"","")+EncodeColor(colorBlue)+
WriteIf(Long AND NOT Buy, "Trade : Long - Entry price Rs."+(BuyPrice),"")+EncodeColor(colorRed)+
WriteIf(shrt AND NOT Sell, "Trade : Short - Entry price Rs."+(SellPrice),"")+"\n"+EncodeColor(colorBlue)+
WriteIf(Long AND NOT Buy, "Current Profit/Loss Rs."+(C-BuyPrice)+"","")+
WriteIf(shrt AND NOT Sell, "Current Profit/Loss Rs."+(SellPrice-C)+"","")+
"\n"+ " Today's Reversal @ "+WriteVal(e,1.2);

GfxSelectFont("Tahoma", Status("pxheight")/12 );
GfxSetTextAlign(6.5 );// center alignment
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
GfxSetBkMode(0); // transparent
GfxTextOut( " " +Close, Status("pxwidth")/2, Status("pxheight")/8 );
GfxSetTextColor( ColorHSB( 42, 42, 42 ) );
TimeFrameSet(inDaily);
V1=V;
V2=Ref(V,-1);
V3=LLV(L,250);
OI1=Ref(OI,-1);
OI2=(OI-OI1)/1000;
L1=LLV(L,250);
L2=L;
H1=H;
Oa=Open;
Ha=High;
La=Low;
Cond11=Oa==Ha;
Cond12=Oa==La;

_SECTION_END();

@pmsprasad30 add code tags so your code may be of use. You must read and follow these instructions before you post.