I have this Flag and pennant code that I am trying to get to work and can not

Can someone look and see what I am getting a few syntax errors on the buy side

Thank you

 

 

// Translation of Markos Katsanos Metastock Code for 'Flags and Pennants' Trading System

 

ZZ = Zig(C,17);

X = BarsSince(ZZ<Ref(ZZ,-1) AND Ref(ZZ,-1)> Ref(ZZ,-2));

X1 = LastValue(X) + 1;

X2 = X1 + 1;

SD = StDev(C,X2);

 

// FVE indicator code

 

PERIOD = 22;

COEFF = 0.1;

intRA = log(H) - log(L);

VINTRA = StDev(intRA, PERIOD);

intER = log(Avg)-log(Ref(Avg,-1));

VINTER = StDev(intER,PERIOD);

CUTOFF = COEFF*(VINTER + VINTRA)*C;

MF = C - (H+L)/2 + Avg - Ref(Avg,-1);

MFV = IIf(MF>CUTOFF,V,IIf(MF<-CUTOFF,-V,0));

FVE = Sum(MFV,PERIOD)/MA(V,PERIOD)/PERIOD*100;

 

// VFI indicator code

 

PERIOD1 = 130;

COEF = 0.2;

VCoef = 2.5;

VINTER1 = StDev(intER, 30);

Cutoff1 = COEF * VINTER1 * C;

VAVE = Ref(MA(V, PERIOD1), -1);

VMAX = VAVE * VCoef;

Vc = Min (V, VMAX);

MF1 = Avg - Ref(Avg, -1);

VCP = IIf( MF1 > Cutoff1, Vc, IIf (MF1 < -Cutoff1, -Vc, 0)); VFI = Sum(VCP, PERIOD1)/VAVE;

 

// Buy Conditions

 

Buy = X1<21 AND X1>2;  //CONDITION 1

AND Ref(LinRegSlope(C,13)/Ref(C,-13)*100, -X1)>2.2; //CONDITION 2

AND Ref(LinRegSlope(C,X2)/Ref(C,-X2),-1)*100<.2AND LinRegSlope(C,X1)/Ref(C,-X1)>-1.2 //CONDITION 3

AND Ref(LinRegSlope(V,X2)/Ref(V,-X2),-1)*100<-2;//CONDITION 4

AND Ref(LinRegSlope(SD,X1),-1)<0; //CONDITION 5

AND StochK(20,3)>55 AND ADX(10)>30 //CONDITION 6

AND FVE>10 AND VFI>-3 //CONDITION 7

AND C>Ref(C,-1) AND C>O; //CONDITION 8

 

//SELL ORDER

 

D1 = ApplyStop(stopTypeNBar,stopModeBars, 24, True);

D2 = LastValue(D1);

zz = Zig(Ref(C,-D2),17);

X = BarsSince(ZZ<Ref(ZZ,-1) AND Ref(ZZ,-1)> Ref(ZZ,-2));

X1 = LastValue(X) + 1; //FLAG DURATION

C1 = LLV(C,(D2+40)); //POLE BASE

C2 = Ref(HHV(C,22),-D2); //POLE TOP

 

BREAK1 = ApplyStop(stopTypeNBar,stopModePercent, 45, True); POLE = (C2-C1)/C1*100; //POLE HEIGHT %

 

// EXIT CONDITIONS

 

Sell = BREAK1 > 1.94*(POLE^0.724) //EXIT CONDITION 1 PROFIT TARGET OR C<Ref(LLV(C,X1), -D2) //EXIT CONDITION 2 STOP LOSS ON BREAKING OF LOWER FLAG TRENDLINE OR (D2>14 AND BREAK1<.25*POLE) //EXIT CONDITION 3 - INACTIVITY OR (D2>3 AND C<.9*HHV(C,4)) //EXIT CONDITION 4 - TRAILING STOP LOSS OR D2>24; //EXIT CONDITION 5 - TIME EXIT

 

 

Mark

__._,_.___

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html






SPONSORED LINKS
Investment management software Real estate investment software Investment property software
Software support Real estate investment analysis software


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to