Rank: Newbie
Groups: Registered, Registered Users Joined: 8/17/2009(UTC) Posts: 2
|
Anyone can help on this.
//BUY
ZZ:=Zig(C,17,%); X:=BarsSince(ZZ<Ref(ZZ,-1)AND Ref(ZZ,-1)>Ref(ZZ,-2)); X1:=LASTVALUE(X)+1; {flag duration} X2:=X1+1; SD:=Stdev(C,X2); PERIOD:=22; COEF:=.1; INTRA:=Log(H)-Log(L); VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, -V,0)),PERIOD)/ Mov(V,PERIOD,S)/PERIOD*100; X1<21 and X1>2 AND {Condition 1} Ref(LinRegSlope(C,13)/Ref(C,-13)*100,-X1)>2.2{Condition 2} AND Ref(LinRegSlope(C,X2)/Ref(C,-X2),-1)*100<.2 AND 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 Stoch(20,3)>55 AND ADX(10)>30{Condition 6} AND FVE>10 AND Fml("VFI")>-3 {Condition 7} AND C>Ref(C,-1) AND C>O {Condition 8}
//SELL D1:=Simulation.CurrentPositionAge; 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:= Simulation.CurrentPositionPerformance*100; POLE:=(C2-C1)/C1*100; {pole height %} {EXIT CONDITIONS} BREAK1 >1.94* Power(pole ,.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}
//VFI indicator
PERIOD:= Input("PERIOD FOR VFI ",5,1300,130); COEF:=.2; VCOEF:=Input("MAX VOLUME CUTOFF",0,50,2.5); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,30); CUTOFF:=COEF*VINTER*C; VAVE:=Ref(Mov(V,PERIOD,S),-1); VMAX:=VAVE*VCOEF; VC:=If(V<VMAX,V,VMAX); MF:=Typical()-Ref(Typical(),-1); VFI:=Sum(If(MF>CUTOFF, +VC, If(MF <-CUTOFF, -VC,0)),PERIOD)/VAVE; Mov(VFI,3,E);
//FVE indicator PERIOD:= Input("PERIOD FOR FVE",5,80,22); COEF:=Input("COEF FOR CUTOFF",0,2,.1); INTRA:=Log(H)-Log(L);VINTRA:=Stdev(INTRA,PERIOD); INTER:=Log(Typical())-Log(Ref(Typical(),-1)); VINTER:=Stdev(INTER,PERIOD); CUTOFF:=COEF*(VINTER+VINTRA)*C; MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1); FVE:=Sum(If(MF>CUTOFF, +V, If(MF <-CUTOFF, -V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100; FVE
|