Afl help it giving error?

hi i have afl it giiving me error can somehelp me to edit and get it workig…

SetChartBkColor(ColorRGB(192,192, 192));
GfxSetBkMode(0);
GfxSetOverlayMode(1);

// Automatic Linear Trend Channel
// Trend is defined using an example trend: MA(cp,100)
// Amibroker AFL code by Edward Pottasch, November 2011

_SECTION_BEGIN(“parameters”);
sdfact=Param(“Standard Deviation Factor”,2,0.5,5,0.1);
offset=Param(“Offset”,2,1,50,1);
tc=ParamList(“Channel Display”,List=“No Channel|Channel|ChannelRT|Both Channels”,1);
_SECTION_END();

function getUptrend(cp)
{
return IIf(cp>MA(cp,100),1,0);
}
function getDowntrend(cp)
{
return IIf(cp<=MA(cp,100),-1,0);
}

// trend definition
cp=(H+L)/2;
TrendUp=getUptrend(cp);
TrendDown=getDowntrend(cp);
totalTrend=IIf(TrendUp,TrendUp,TrendDown);
dtotalTrend=totalTrend-Ref(totalTrend,-1);
vtotalTrend=ValueWhen(dtotalTrend,dtotalTrend);

// definition start points up and down trend
cbull=vtotalTrend>0 AND Ref(vtotalTrend,-1)<0;cbull=Ref(cbull,1);
cbear=vtotalTrend<0 AND Ref(vtotalTrend,-1)>0;cbear=Ref(cbear,1);
cbull=vtotalTrend>0 AND Ref(vtotalTrend,-1)<0;cbull=Ref(cbull,1);cbull[BarCount-1]=1;
cbear=vtotalTrend<0 AND Ref(vtotalTrend,-1)>0;cbear=Ref(cbear,1);cbear[BarCount-1]=1;

// definition areas up and down trend
nwbull=Ref(Flip(cbull,cbear),-1);nwbear=Ref(Flip(cbear,cbull),-1);

xxbull=BarsSince(cbull);xxbull[BarCount-1]=xxbull[BarCount-2]+1;
aaabull=LinRegIntercept(cp,xxbull);bbbbull=LinRegSlope(cp,xxbull);
daabull=Ref(ValueWhen(cbear,aaabull,0),-1);dbbbull=Ref(ValueWhen(cbear,bbbbull,0),-1);
yybull=daabull+dbbbull*(xxbull-1);yybull=IIf(xxbull>Max(offset,1),yybull,Null);
wdbull=sdfact*StdErr(cp,xxbull);wdbull=Ref(ValueWhen(cbear,wdbull,0),-1);

xxbear=BarsSince(cbear);xxbear[BarCount-1]=xxbear[BarCount-2]+1;
aaabear=LinRegIntercept(cp,xxbear);bbbbear=LinRegSlope(cp,xxbear);
daabear=Ref(ValueWhen(cbull,aaabear,0),-1);dbbbear=Ref(ValueWhen(cbull,bbbbear,0),-1);
yybear=daabear+dbbbear*(xxbear-1);yybear=IIf(xxbear>Max(offset,1),yybear,Null);
wdbear=sdfact*StdErr(cp,xxbear);wdbear=Ref(ValueWhen(cbull,wdbear,0),-1);

llbull=LinearReg(cp,xxbull);llbull=IIf(xxbull>Max(Offset,1),llbull,Null);
llbullp=LinearReg(cp,xxbull)+sdfactStdErr(cp,xxbull);llbullp=IIf(xxbull>Max(Offset,2),llbullp,Null);
llbullm=LinearReg(cp,xxbull)-sdfact
StdErr(cp,xxbull);llbullm=IIf(xxbull>Max(Offset,2),llbullm,Null);
llbear=LinearReg(cp,xxbear);llbear=IIf(xxbear>Max(Offset,1),llbear,Null);
llbearp=LinearReg(cp,xxbear)+sdfactStdErr(cp,xxbear);llbearp=IIf(xxbear>Max(Offset,2),llbearp,Null);
llbearm=LinearReg(cp,xxbear)-sdfact
StdErr(cp,xxbear);llbearm=IIf(xxbear>Max(Offset,2),llbearm,Null);
//nwbull=C<k1; nwbear=C>k1;
_SECTION_BEGIN(“Chart Colors”);

Color=IIf( H<MA(C,100) AND H<MA(C,367) ,colorWhite,
//IIf( L>MA(C,100) AND L>MA(C,367) ,colorBlue,
IIf((( C<MA(C,100) AND C>MA(C,367)) OR ( C>MA(C,100) AND C<MA(C,367)) AND (nwbear OR nwbear)) ,colorWhite,colorGreen));

//Plot( C, “open”, color, styleBar | ParamStyle(“Style”) | GetPriceStyle() );

_SECTION_BEGIN(“HA”);
_SECTION_BEGIN(“System”);

TimeFrameSet( Interval());
mult=Param(“multi”, 2.0, 0.1, 10, 0.05);
Aper=Param(“ATR period”, 5, 2, 100, 1 );
atrvalue=(mult*ATR(aper));

Bs[0]=0;//=L;
L[0]=0;
C[0]=0;

for( i = 9; i < BarCount; i++ )
{
if ( L[ i ] > L[ i - 1 ] AND L[ i ] > L[ i - 2 ] AND L[ i ] > L[ i - 3 ] AND L[ i ] > L[ i - 4 ] AND
L[ i ] > L[ i - 5 ] AND L[ i ] > L[ i - 6 ] AND L[ i ] > L[ i - 7 ] AND L[ i ] > L[ i - 8 ] AND
L[ i ] > L[ i - 9 ] AND C[ i ] > bs[ i - 1 ])
{
bs[ i ] = L[ i ] - ATRvalue[ i ] ;

}
else
{
if ( H[ i ] < H[ i - 1 ] AND H[ i ] < H[ i - 2 ] AND H[ i ] < H[ i - 3 ] AND H[ i ] < H[ i - 4 ] AND
H[ i ] < H[ i - 5 ] AND H[ i ] < H[ i - 6 ] AND H[ i ] < H[ i - 7 ] AND H[ i ] < H[ i - 8 ] AND
H[ i ] < H[ i - 9 ] AND C[ i ] < bs[ i - 1 ] )
{
bs[ i ] = H[ i ] + ATRvalue[ i ];

}
else
{
bs[ i ] = bs[ i - 1];
} }}

//====================================================
Mycolor=IIf(C>bs,colorLime,colorRed);
//bcolor=IIf(C>bs,colorYellow,colorBlue);
//PlotOHLC( Open, High, Low, Close, “”, Mycolor, styleBar| styleThick );
//Plot(bs,“ATS”,bcolor,1|styleThick);

SL = ( HHV( H, 22 ) + LLV( L, 22) ) / 2;
TL = ( HHV( H, 8 ) + LLV( L, 8 ) ) / 2;
DL = Ref( C, 22 );
Span1 = ( SL + TL ) / 2 ;
Span2 = Ref(( HHV( H, 44) + LLV(L, 44) ) / 2, -4) ;
spanmid=(span1+span2)/2;
//PlotOHLC(Span1,Span2,Span1,Span2,"",IIf(Span1>Span2,colorBrightGreen,colorGreen),styleCloud|4096);

rt=CCRT_AB();

//============================ End Indicator Code =========

rt=CCRT_IntraTrade();

GraphXSpace = 5;
pxHeight = Status( “pxchartheight” ) ;
xx = Status( “pxchartwidth”);
Left = 1100;
width = 310;
x = 5;
x2 = 280;
y = pxHeight;

GfxSetTextColor( colorBlue );
GfxTextOut( ( " (Trade on next bar) "),20,y-25);
rt=CCRT_IntraTrade();

c2=y1=L>x4 AND L>y5 AND L>x3 AND L>y4 AND L>y2 AND L>x1 AND L>x2 AND L>y3 AND L>x2 ;

c4=y2=H<x1 AND H<x4 AND H<y5 AND H<x3 AND H<y4 AND H<y2 AND H<y2 AND H<y3 AND H<x2 ;
Buy=Null;
Short=Null;
Cover=Null;
Sell=Null;
k1= H<MA(C,100) AND H<MA(C,367) ;
k2= (C<MA(C,100) AND C>MA(C,367)) OR ( C>MA(C,100) AND C<MA(C,367)) AND (nwbear OR nwbear);

y3=(H<x4 OR H<y5 OR H<x3 OR H<y4 OR H<y2 OR H<y1 OR H<x1 OR H<y3 OR H<x2 ) AND (L>x1 OR L>x4 OR L>x4 OR L>y5 OR L>y1 OR L>x3 OR L>y4 OR L>y2 OR L>y2 OR L>y3 OR L>x2);

//
//rt=CCRT_AmiScan();
Color=IIf(y1 AND C>bs,colorBlue,IIf(y2 OR k1 OR k2,colorWhite,IIf(y3,colorGreen,colorYellow)));
_SECTION_BEGIN(“1”);

Buy=Null;
Short=Null;
Cover=Null;
Sell=Null;

for(i=2;i<BarCount-1;i++){

Buy2[i]= color[i]==colorBlue ;

Buy= Buy2 ;

Short5[i]=color[i]==colorGreen OR COLOR[i]==colorWhite ;

Short=Short5;
}
Plot(C,"",color,styleBar|styleThick);

Buy=Buy AND span1>span2 AND C>BS AND C>ab;
Short=Short AND C<spanmid AND C<BS AND C<ba;

C2=Buy; C4=Short; rt=CCRT_Chartist();

//PlotShapes(BuyshapeUpTriangle,colorGreen,0,O,-10);
//PlotShapes(Short
shapeDownTriangle,colorRed,0,O,-10);

Bbuy = Buy;
Sshort=Short;

//Buy=ExRem(Buy,Sell);
//Sell=ExRem(Sell,Buy);

Bbuy=ExRem(Bbuy,Sshort);
Sshort=ExRem(Sshort,Bbuy);
//PlotShapes(IIf(bBuy, shapeUpArrow, shapeNone),colorBlue, 0,L, Offset=-45);
//PlotShapes(IIf(Sshort, shapeDownArrow, shapeNone),colorRed, 0,H, Offset=-45);
sx=ATR(100)(Param(“SL”,2,-10,4,0.5,0));
ex=ATR(10)/Param(“EFA”,10,1,20,1,0);
tx=ATR(100)
(Param(“TGT”,6,0.5,100,0.5,0));
dist = 2.5*ATR(10);

realentry=IIf(BarsSince(Sshort)<BarsSince(bBuy), ValueWhen(Sshort,L,1)-ex,ValueWhen(bBuy,H,1)+ex);

realstop=IIf(BarsSince(bBuy)<BarsSince(Sshort), ValueWhen(bBuy,L,1)-sx,ValueWhen(Sshort,H,1)+sx);
target=IIf(BarsSince(Sshort)<BarsSince(bBuy), ValueWhen(Sshort,L,1)-tx,ValueWhen(bBuy,H,1)+tx);

//Plot(realentry,"",colorDarkBlue,styleLine);
//Plot(realstop,"",colorDarkRed,styleDashed);
//Plot(target,"",colorDarkGreen,styleLine);
Short=Short AND C<realstop AND realentry<realstop;

Buy= Buy AND (C>realstop AND REALENTRY>realstop );
Buy=ExRem(Buy,Short);
Short=ExRem(Short,Buy);

PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorBlue, 0,L, Offset=-5);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorBlue, 0,H, Offset=-5);

_SECTION_BEGIN(“MaxProfit”);
BuyPrice=ValueWhen(Buy,C,1);
ShortPrice=ValueWhen(Short,C,1);
B1=BarsSince(Buy);
S1=BarsSince(Short);
B2=BarsSince(Cover);
S2=BarsSince(Sell);
CB=BarIndex();
LSB=IIf(B1>S1,S1,B1);
LS=IIf(B1>S1,-1,1);
HHV1=HHV(H,B1);
LLV1=LLV(L,S1);
MP=IIf(LS==-1,ShortPrice-LLV1,HHV1-BuyPrice);
MP=IIf(B1==0 OR S1==0 OR B2<=LSB OR S2<=LSB,0,MP);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));

Title=Title+ “\n\n\n MaxProfit=” + MP ;
_SECTION_END();

Sell=Short;

TrendSL=IIf(C>realstop,realstop,realstop);

for(i=BarCount-1;i>1;i–)

{

if(Buy[i] == 1)

{

entry = C[i];

sig = “BUY”;

sl = TrendSL[i];

STP = C[i]-0.004*BuyPrice[i];

tar1 = entry + (entry * .0050);

tar2 = entry + (entry * .0078);

tar3 = entry + (entry * .01);

bars = i;

i = 0;

}

if(Sell[i] == 1)

{

sig = “SELL”;

entry = C[i];

sl = TrendSL[i];

STP = C[i]+0.004*SellPrice[i];

bars = i;

i = 0;

}

}

Offset = 20;

Clr = IIf(sig == “BUY”, colorLime, colorRed);

ssl = IIf(bars == BarCount-1, TrendSL[BarCount-1], Ref(TrendSL, -1));

sl = ssl[BarCount-1];
messageboard = ParamToggle(“Message Board”,“Show|Hide”,1);

if (messageboard == 1 )

{

GfxSelectFont( “Tahoma”, 13, 100 );

GfxSetBkMode( 1 );

GfxSetTextColor( colorWhite );

if ( sig ==“BUY”)

{

GfxSelectSolidBrush( colorBlue ); // this is the box background color

}

else

{

GfxSelectSolidBrush( colorRed ); // this is the box background color

}

pxHeight = Status( “pxchartheight” ) ;

xx = Status( “pxchartwidth”);

Left = 1100;

width = 310;

x = 5;

x2 = 290;

y = pxHeight;

GfxSelectPen( colorGreen, 1); // broader color

GfxRoundRect( x, y - 98, x2, y , 7, 7 ) ;

GfxTextOut( ( " "),13,y-100);

GfxTextOut( (" "),27,y-100);

GfxTextOut( (“Last " + sig + " Signal " + (BarCount-bars-1) * Interval()/60 + " mins ago”), 13, y-80) ; // The text format location

GfxTextOut( ("" + WriteIf(sig ==“BUY”,sig + " @ “,sig + " @”) + " : " + entry), 13, y-60);

GfxTextOut( (“Trailing SL : " + Ref(TrendSL,-1) + " (” + WriteVal(IIf(sig == “SELL”,entry-sl,sl-entry), 2.2) + “)”), 13, y-40);

/*GfxTextOut( ("TGT:1 : " + tar1), 13, y -80);

GfxTextOut( ("TGT:2 : " + tar2), 13,y-60);

GfxTextOut( ("TGT:3 : " + tar3), 13,y-40);*/

//GfxTextOut( ("Current P/L : " + WriteVal(IIf(sig == “BUY”,(C-entry),(entry-C)),2.2)), 13, y-22);;

GfxTextOut( " MAX P/L : " + MP, 13, y-22);;

//Title=Title+ “\n\n\n MaxProfit=” + MP ;
//Magfied Market Price
}
_SECTION_END();

Can you please tag the question under the right category?