1 Entry Binary 2 Exit Binary 3 Trade Equity GV LC 4 Trade Equity GV LE 5 Trade Equity GV PLE 6 Trade Equity GV Funds LE 7 Trade Equity GV Funds PLE 8 Trade Equity GV SE 9 Trade Equity LC 10 Trade Equity LE 11 Trade Equity SE 12 Trade Equity LC Display 13 Trade Equity LE Display 14 Trade Equity SE Display ============ Entry Binary ============ This indicator gives a binary entry signal that nominally matches the binary 'Enter Long' signals of the 'PS Fractal Trading Systems' in MetaStock. The 'Trade Equity' family of indicators can use either price stop or binary signals. Note that it makes no pretence of being a valid system entry and should not be treated as such. Trade Equity should be used to test your trading systems. This code is provided just to help you get started along that path. Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any indicators from the Trade Equity series. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ================== Trade Equity GV LC ================== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV LC' assumes compounding position sizes (reinvested gains), and long only trades. Other indicators in the family are available for equal (fixed) positions and/or short trades. Four explorations are available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV LC'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV LC} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 1=O 2=C 3=H 4=L 5=Stop", 1,5,2); Z:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy Delay", 0,3,0); Xd:=Input("Sell Delay",0,3,0); Cn:=Input("Buy / Sell Costs",0,9999,3030); I:=Input("Display Options 0-12",0,12,0); Cp:=5000; {* trade capital} N:= Fml("Entry Binary"); {Buy} Ns:=0; X:= Fml("Exit Binary"); {Sell} Xs:=0; {* end user area *} I:=ExtFml("GV.SetVar","Lc",I); Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((N+X)>-1)=1; N:=(I>-1)*N; K:=If(I,Y,ValueWhen(2,1,Y)); Y:=If((N+X=0)*Alert(N*X,2),K,Y); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); En:=Tr+(Alert(Tr=0,2)+I>0)=2; N:=Cum(I*Cp-En*Cn-Ex*Cx); Ns:= ExtFml("Calc.Profit",Alert(Tr,2)*If(B=5,1,En=0), If(B+En=6,N,ValueWhen(2,1,N)), If((B+En=6)+((B<5)*Alert(En,2)*(En=0)),(Y-A)/A,(Y-K)/K)); M:=N+Ns; X:=A*(M+(Ex*Cx))/Y; Xs:=If((Ex+Lb)*(M>X+Cx),M-X-Cn,0); Xd:=If((Ex+Lb)*(M<=X+Cx),M-X-Cn,0); Nd:=Alert(Tr,2)*(M-If(I,M,ValueWhen(2,1,ValueWhen(1,I+(Tr=0),M)))); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity LC Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ================== Trade Equity GV LE ================== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV LE' assumes equal (fixed) position sizes and long only trades. Other indicators in the family are available for compounding positions (reinvested gains) and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV LC'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV LE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 1=O 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy Delay", 0,5,0); Xd:=Input("Sell Delay",0,5,0); Cn:=Input("Buy / Sell Costs",0,9999,3030); I:=Input("Display Option 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Entry Binary"); {Buy} Ns:=0; X:=Fml("Exit Binary"); {Sell} Xs:=0; {* end of user area *} I:=ExtFml("GV.SetVar","Le",I); F:=If(F=0,1,F);Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr*(Alert(Tr=0,2)+I>0); N:=(Ex+Lb>0)*If(Cp=0,Y-A-Cn-Cx,(F-Cn)*(Y/A)-F-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,Y-A-Cn,(F-Cn)*(Y/A)-F); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity LE Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- =================== Trade Equity GV PLE =================== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV PLE' assumes equal (fixed) position sizes and long only trades. It uses percentage rather than dollar amount commissions. Other indicators in the family are available for compounding positions (reinvested gains) and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV PLE'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV PLE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 1=O 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy / Sell Delays, ##", 0,55,0); Cn:=Input("Buy Cost, %", 0,9,.6)/100; Cx:=Input("Sell Cost, %",0,9,.6)/100; I:=Input("Display Option 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Entry Binary"); {Buy} Ns:=0; X:=Fml("Exit Binary"); {Sell} Xs:=0; {* end of user area *} I:=ExtFml("GV.SetVar","Le",I); F:=If(F=0,1,F);Ns:=(B=5)*Ns; Xd:=LastValue(Nd-10*Int((Nd+.1)/10)); Nd:=LastValue(Int((Nd+.1)/10)); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If(Z<5 AND X=0,C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)* (B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); Cn:=ValueWhen(1,En,F*Cn*If(F>1,A,Cp*(1-Cn/(1+Cn)))); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr+(Alert(Tr=0,2)+I>0)=2; Cx:=Cx*Ex*((F-Cn)*(Y/A)); N:=(Ex+Lb>0)*((F-Cn)*(Y/A)-F-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*((F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*((F-Cn)*(Y/A)-F); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity PLE Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ======================== Trade Equity GV Funds LE ======================== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV Funds LE' assumes equal (fixed) position sizes and long only trades. It can be used with funds that do not have an OPEN price. Other indicators in the family are available for compounding positions (reinvested gains) and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV LC'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV Funds LE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Sell 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy Delay", 0,5,0); Xd:=Input("Sell Delay",0,5,0); Cn:=Input("Buy / Sell Costs",0,9999,3030); I:=Input("Display Option 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Entry Binary"); {Buy} Ns:=0; X:=Fml("Exit Binary"); {Sell} Xs:=0; {* end of user area *} I:=ExtFml("GV.SetVar","Le",I); F:=If(F=0,1,F);Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=3,H,If(B=4,L,C))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=3,H,If(Z=4,L,C))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr*(Alert(Tr=0,2)+I>0); N:=(Ex+Lb>0)*If(Cp=0,Y-A-Cn-Cx,(F-Cn)*(Y/A)-F-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,Y-A-Cn,(F-Cn)*(Y/A)-F); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity Funds LE Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ========================= Trade Equity GV Funds PLE ========================= This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV Funds PLE' assumes equal (fixed) position sizes and long only trades. It can be used with funds that do not have an OPEN price. It uses percentage rather than dollar amount commissions. Other indicators in the family are available for compounding positions (reinvested gains) and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV LC'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV Funds PLE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Sell 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy / Sell Delays, ##", 0,55,0); Cn:=Input("Buy Cost, %", 0,9,0.6)/100; Cx:=Input("Sell Cost, %",0,9,.6)/100; I:=Input("Display Option 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Entry Binary"); {Buy} Ns:=0; X:=Fml("Exit Binary"); {Sell} Xs:=0; {* end of user area *} I:=ExtFml("GV.SetVar","Le",I); F:=If(F=0,1,F);Ns:=(B=5)*Ns; Xd:=LastValue(Nd-10*Int((Nd+.1)/10)); Nd:=LastValue(Int((Nd+.1)/10)); M:=If(Ns>0,Ns,If(B=3,H,If(B=4,L,C))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=3,H,If(Z=4,L,C))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If(Z<5 AND X=0,C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)* (B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); Cn:=ValueWhen(1,En,F*Cn*If(F>1,A,Cp*(1-Cn/(1+Cn)))); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr+(Alert(Tr=0,2)+I>0)=2; Cx:=Cx*Ex*((F-Cn)*(Y/A)); N:=(Ex+Lb>0)*((F-Cn)*(Y/A)-F-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*((F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*((F-Cn)*(Y/A)-F); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity Funds PLE Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ================== Trade Equity GV SE ================== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity GV SE' assumes equal (fixed) position sizes and short only trades. Other indicators in the family are available for compounding positions (reinvested gains) and/or long trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity GV SE'. This indicator and its associated explorations can only be used with MetaStock version 7.0 and higher. MS 6.52 does not support dll use. ---8<--------------------------- {Trade Equity GV SE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Cover 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Sell Delay", 0,3,0); Xd:=Input("Cover Delay",0,3,0); Cn:=Input("Sell / Cover Costs",0,9999,3030); I:=Input("Display Options 0-12",0,12,0); Cp:=5000; {trade capital} F:=1; {trade size Fml(), <1 =%, >1 =shares} N:=Fml("Exit Binary"); {Sell Short} Ns:=0; X:=Fml("Entry Binary"); {Buy to Cover} Xs:=0; {* end user area *} I:=ExtFml("GV.SetVar","Se",I); F:=If(F=0,1,F);Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2) *(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr*(Alert(Tr=0,2)+I>0); N:=(Ex+Lb>0)*If(Cp=0,A-Y-Cn-Cx,(F-Cn)*((A-Y)/A)-Cn-Ex*Cx); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=Alert(Tr,2)*If(Cp=0,A-Y,(F-Cn)*((A-Y)/A)-Cn-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,A-Y-Cn,(F-Cn)*((A-Y)/A)-Cn); I:=ExtFml("GV.SetVar","I",I);I:=ExtFml("GV.SetVar","N",N); I:=ExtFml("GV.SetVar","X",X);I:=ExtFml("GV.SetVar","Cn",Cn); I:=ExtFml("GV.SetVar","Cp",Cp);I:=ExtFml("GV.SetVar","Cx",Cx); I:=ExtFml("GV.SetVar","En",En);I:=ExtFml("GV.SetVar","Ex",Ex); I:=ExtFml("GV.SetVar","Lb",Lb);I:=ExtFml("GV.SetVar","Nd",Nd); I:=ExtFml("GV.SetVar","Ns",Ns);I:=ExtFml("GV.SetVar","Tr",Tr); I:=ExtFml("GV.SetVar","Xd",Xd);I:=ExtFml("GV.SetVar","Xs",Xs); I:=ExtFml("GV.SetVar","F",F);I:=ExtFml("GV.SetVar","Eq",M); {Fml("Trade Equity SE Display");}M; ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- =============== Trade Equity LC =============== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity LC' assumes compounding position sizes (reinvested gains) and long only trades. Other indicators in the family are available for equal (fixed) positions and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity LC'. ---8<--------------------------- {Trade Equity LC} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 1=O 2=C 3=H 4=L 5=Stop", 1,5,2); Z:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy Delay", 0,3,0); Xd:=Input("Sell Delay",0,3,0); Cn:=Input("Buy / Sell Costs",0,9999,3030); En:=Input("Display Options 0-12",0,12,0); Cp:=5000; {* trade capital} N:= Fml("Entry Binary"); {Buy} Ns:=0; X:= Fml("Exit Binary"); {Sell} Xs:=0; {* end user area *} Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100); Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((N+X)>-1)=1; N:=(I>-1)*N; K:=If(I,Y,ValueWhen(2,1,Y)); Y:=If((N+X=0)*Alert(N*X,2),K,Y); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); Nd:=En; En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); En:=Tr+(Alert(Tr=0,2)+I>0)=2; Z:=Nd; N:=Cum(I*Cp-En*Cn-Ex*Cx); Ns:=Cum(If(Alert(Tr,2)*If(B=5,1,En=0), (PREV+If(B+En=6,N,If(I,N+Cn,ValueWhen(2,1,N))))* If((B+En=6)+((B<5)*(En=0)*Alert(En,2)),(Y-A)/A,(Y-K)/K),0)); M:=N+Ns; X:=A*(M+(Ex*Cx))/Y; Xs:=If((Ex+Lb)*(M>X+Cx),M-X-Cn,0); Xd:=If((Ex*Lb)*(M<=X+Cx),M-X-Cn,0); Nd:=Alert(Tr,2)*(M-If(I,M,ValueWhen(2,1,ValueWhen(1,I+(Tr=0),M)))); { Display options: 0 total $ equity 1 total % equity 2 $ equity/trade 3 % equity/trade 4 winning trade $ 5 losing trade $ 6 winning trade # 7 losing trade # 8 trade in progress 9 bars/trade 10 bars - all trades 11 MFE 12 MAE} If(Z=0,M, If(Z=1,100*(M-Cp)/Cp, If(Z=2,Nd, If(Z=3,100*Nd/ValueWhen(1,I+(Alert(Tr,2)=0),M), If(Z=4,Cum(Xs), If(Z=5,Cum(Xd), If(Z=6,Cum(Xs>0), If(Z=7,Cum((Ex+Lb>0)*(Xs=0)), If(Z=8,Tr, If(Z=9,BarsSince(I+(Alert(Tr,2)=0))*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,HighestSince(1,I,Nd),LowestSince(1,I,Nd))))))))))))); ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- =============== Trade Equity LE =============== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity LE' assumes equal (fixed) position sizes, and long only trades. Other indicators in the family are available for compounding positions (reinvested gains) and/or short trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to inatall 'Trade Equity LE'. ---8<--------------------------- {Trade Equity LE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Buy 1=O 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Buy Delay", 0,5,0); Xd:=Input("Sell Delay",0,5,0); Cn:=Input("Buy / Sell Costs",0,9999,3030); En:=Input("Display Option 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Entry Binary"); {Buy} Ns:=0; X:=Fml("Exit Binary"); {Sell} Xs:=0; {* end of user area *} F:=If(F=0,1,F);Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*(Alert(N,Nd)=0)); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*(Alert(X,Xd)=0)); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); Nd:=En; En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr*(Alert(Tr=0,2)+I>0);Z:=Nd; N:=(Ex+Lb>0)*If(Cp=0,Y-A-Cn-Cx,(F-Cn)*(Y/A)-F-Ex*Cx); B:=If(Alert(Tr,2),1+BarsSince(En OR I),0); Xs:=Alert(Tr,2)*If(Cp=0,Y-A,(F-Cn)*(Y/A)-F-Ex*Cx); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+Tr*(Lb=0)*If(Cp=0,Y-A-Cn,(F-Cn)*(Y/A)-F);{M;} {Display options 0 total $ equity 1 total % equity 2 $ equity/trade 3 % equity/trade 4 winning trade $ 5 losing trade $ 6 winning trade # 7 losing trade # 8 trade in progress 9 bars/trade 10 bars/all trades 11 MFE 12 MAE} X:=(Cp>0)/(Cp+(Cp=0)); If(Z=0,M, If(Z=1,100*(M-Cp)*X, If(Z=2,N+M-Cp-Cum(N), If(Z=3,100*(N+M-Cp-Cum(N))*X, If(Z=4,Cum((N>0)*N), If(Z=5,Cum((N<0)*N), If(Z=6,Cum(N>0), If(Z=7,Cum(Ex+Lb>0 AND N<=0), If(Z=8,Tr, If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,Ns,Nd)))))))))))); ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- =============== Trade Equity SE =============== This is one of a series of 'Trade Equity' indicators used to create trading system equity curves without running the System Tester. 'Trade Equity SE' assumes equal (fixed) position sizes, and short only trades. Other indicators in the family are available for compounding positions (reinvested gains) and/or long trades. Four explorations are also available for each TE indicator. The explorations create trading system reports for modest portfolios through to entire databases. Several system statistics in addition to the equity curve can be plotted directly onto the chart of any security. Disabling the display option improves the execution speed of TE explorations. Cut and paste the 'Entry Binary' and 'Exit Binary' indicators before attempting to install 'Trade Equity SE'. ---8<--------------------------- {Trade Equity SE} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} B:=Input("Sell 1=O 2=C 3=H 4=L 5=Stop" ,1,5,2); Z:=Input("Cover 1=O 2=C 3=H 4=L 5=Stop",1,5,2); Nd:=Input("Sell Delay", 0,3,0); Xd:=Input("Cover Delay",0,3,0); Cn:=Input("Sell / Cover Costs",0,9999,3030); En:=Input("Display Options 0-12",0,12,0); Cp:=5000; {* trade capital} F:=1; {* trade size Fml(), <1 =%, >1 =shares} N:=Fml("Exit Binary"); {Sell Short} Ns:=0; X:=Fml("Entry Binary"); {Buy to Cover} Xs:=0; {* end user area *} F:=If(F=0,1,F);Ns:=(B=5)*Ns; Cx:=Cn-100*Int(Cn/100);Cn:=Int(Cn/100); M:=If(Ns>0,Ns,If(B=1,O,If(B=3,H,If(B=4,L,C)))); N:=N AND Alert(N=0,2)+(Cum(N>-1)=1); X:=X AND (Z<5)*(Alert(X=0,2)+(Cum(N>-1)=1)); N:=If(Nd=0,N,Alert(N,Nd+1)*Alert(N,Nd)=0); N:=If(B<5,N,Ns>0); Y:=If(Xs>0,Min(H,Max(L,Xs)),If(Z=1,O,If(Z=3,H,If(Z=4,L,C)))); X:=If(Xd=0,X,Alert(X,Xd+1)*Alert(X,Xd)=0); X:=X+Xs>0; Y:=If((Z<5)*(X=0),C,Y);Y:=If((Xs>0)*N*X,Xs,Y); I:=Cum((F+N+X)>-1)=1; Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y); N:=(I>-1)*N; F:=ValueWhen(1,I+N,F); Tr:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1)); Tr:=If((N+X>1)*(Alert(Tr,2) OR ((Nd+Xd<1)*(B<>2) *(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,Tr); Nd:=En; En:=Tr+Alert(Tr=0,2)=2 OR I; Ex:=(Tr=0)*Alert(Tr,2); M:=If(I*(N=0),C,M); Lb:=Alert(Tr,2)*(LastValue(Cum(1))=Cum(1)); A:=ValueWhen(1,En,If(M=0,1,M)); F:=ValueWhen(1,En,If(F>1,A*F+Cn,Cp*F)); En:=Tr+(Alert(Tr=0,2)+I>0)=2;Z:=Nd; N:=If(Ex+Lb>0,If(Cp=0,A-Y-Cn-Cx,(F-Cn)*((A-Y)/A)-Cn-If(Ex,Cx,0)),0); B:=Alert(Tr,2)*(1+BarsSince(En+I)); Xs:=If(Alert(Tr,2),If(Cp=0,A-Y,(F-Cn)*((A-Y)/A)-Cn-If(Ex,Cx,0)),0); Nd:=LowestSince(1,I,Xs); Ns:=HighestSince(1,I,Xs); X:=Cum((Ex+Lb>0)*(N>0)*B); Xd:=Cum((Ex+Lb>0)*(N<=0)*B); M:=Cum(N)+Cp+(Tr AND Lb=0)*If(Cp=0,A-Y-Cn,(F-Cn)*((A-Y)/A)-Cn);{M;} { Display options 0 total $ equity 1 total % equity 2 $ equity/trade 3 % equity/trade 4 winning trade $ 5 losing trade $ 6 winning trade # 7 losing trade # 8 trade in progress 9 bars/trade 10 bars - all trades 11 MFE 12 MAE} X:=(Cp>0)/(Cp+(Cp=0)); If(Z=0,M, If(Z=1,100*(M-Cp)*X, If(Z=2,N+M-Cp-Cum(N), If(Z=3,100*(N+M-Cp-Cum(N))*X, If(Z=4,Cum((N>0)*N), If(Z=5,Cum((N<0)*N), If(Z=6,Cum(N>0), If(Z=7,Cum(Ex+Lb>0 AND N<=0), If(Z=8,Tr, If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,Ns,Nd)))))))))))); ---8<--------------------------- Cut and paste 'Entry Binary' and 'Exit Binary' into the Indicator Builder before attempting to install any Trade Equity indicators. ---8<--------------------------- {Entry Binary} F1:=ValueWhen(1,Cum(1)=5 OR (HRef(L,-2) AND Ref(L,-1)>Ref(L,-2) AND Ref(L,-3)>Ref(L,-2) AND Ref(L,-4)>Ref(L,-2)),Ref(L,-2)); Cross(F2,L); ---8<--------------------------- ======================= Trade Equity LC Display ======================= This indicator can be linked to 'Trade Equity GV LC' to enable several system statistics in addition to the equity curve to be plotted directly onto the chart of any security. Leaving the display option disable improves the execution speed of TE explorations. ---8<--------------------------- {Trade Equity LC Display} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} {Use with 'Trade Equity GV LC'} {Display options: 0, total dollar equity 1, total percent equity 2, dollar equity per trade 3, percent equity per trade 4, amount of winning trades 5, amount of losing trades 6, number of winning trades 7, number of losing trades 8, trade in progress 9, bars in a trade 10, total bars in all trades 11, Maximum Favorable Excursion 12, Maximum Adverse Excursion } M:=ExtFml("GV.GetVar","Eq"); Z:=ExtFml("GV.GetVar","Lc"); I:=ExtFml("GV.GetVar","I"); N:=ExtFml("GV.GetVar","N"); X:=ExtFml("GV.GetVar","X"); Cn:=ExtFml("GV.GetVar","Cn"); Cp:=ExtFml("GV.GetVar","Cp"); Cx:=ExtFml("GV.GetVar","Cx"); En:=ExtFml("GV.GetVar","En"); Ex:=ExtFml("GV.GetVar","Ex"); Lb:=ExtFml("GV.GetVar","Lb"); Nd:=ExtFml("GV.GetVar","Nd"); Ns:=ExtFml("GV.GetVar","Ns"); Tr:=ExtFml("GV.GetVar","Tr"); Xd:=ExtFml("GV.GetVar","Xd"); Xs:=ExtFml("GV.GetVar","Xs"); If(Z=0,M, If(Z=1,100*(M-Cp)/Cp, If(Z=2,Nd, If(Z=3,100*Nd/ValueWhen(1,I OR Alert(Tr,2)=0,M), If(Z=4,Cum(Xs), If(Z=5,Cum(Xd), If(Z=6,Cum(Xs>0), If(Z=7,Cum(Ex+Lb>0 AND Xs=0), If(Z=8,Tr, If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,HighestSince(1,I,Nd), LowestSince(1,I,Nd))))))))))))); ---8<--------------------------- ======================= Trade Equity LE Display ======================= This indicator can be linked to 'Trade Equity GV LE' to enable several system statistics in addition to the equity curve to be plotted directly onto the chart of any security. Leaving the display option disable improves the execution speed of TE explorations. ---8<--------------------------- {Trade Equity LE Display} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} {use with Trade Equity GV LE} {Display options: 0, total dollar equity 1, total percent equity 2, dollar equity per trade 3, percent equity per trade 4, amount of winning trades 5, amount of losing trades 6, number of winning trades 7, number of losing trades 8, trade in progress 9, bars in a trade 10, total bars in all trades 11, Maximum Favourable Excursion 12, Maximum Adverse Excursion } M:=ExtFml("GV.GetVar","Eq"); Z:=ExtFml("GV.GetVar","Le"); I:=ExtFml("GV.GetVar","I"); N:=ExtFml("GV.GetVar","N"); X:=ExtFml("GV.GetVar","X"); Cn:=ExtFml("GV.GetVar","Cn"); Cp:=ExtFml("GV.GetVar","Cp"); Cx:=ExtFml("GV.GetVar","Cx"); En:=ExtFml("GV.GetVar","En"); Ex:=ExtFml("GV.GetVar","Ex"); Lb:=ExtFml("GV.GetVar","Lb"); Nd:=ExtFml("GV.GetVar","Nd"); Ns:=ExtFml("GV.GetVar","Ns"); Tr:=ExtFml("GV.GetVar","Tr"); Xd:=ExtFml("GV.GetVar","Xd"); Xs:=ExtFml("GV.GetVar","Xs"); A:=(Cp>0)/(Cp+(Cp=0)); If(Z=0,M, If(Z=1,100*(M-Cp)*A, If(Z=2,N+M-Cp-Cum(N), If(Z=3,100*(N+M-Cp-Cum(N))*A, If(Z=4,Cum((N>0)*N), If(Z=5,Cum((N<0)*N), If(Z=6,Cum(N>0), If(Z=7,Cum(Ex+Lb>0 AND N<=0), If(Z=8,Tr, If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,Ns,Nd)))))))))))); ---8<--------------------------- ======================= Trade Equity SE Display ======================= This indicator can be linked to 'Trade Equity GV SE' to enable several system statistics in addition to the equity curve to be plotted directly onto the chart of any security. Leaving the display option disable improves the execution speed of TE explorations. ---8<--------------------------- {Trade Equity SE Display} {V5.0} {© 2004 Roy Larsen, rlarsen@man.quik.co.nz} {Use with 'Trade Equity GV SE'} {Display options: 0, total dollar equity 1, total percent equity 2, dollar equity per trade 3, percent equity per trade 4, amount of winning trades 5, amount of losing trades 6, number of winning trades 7, number of losing trades 8, trade in progress 9, bars in a trade 10, total bars in all trades 11, Maximum Favourable Excursion 12, Maximum Adverse Excursion } M:=ExtFml("GV.GetVar","Eq"); Z:=ExtFml("GV.GetVar","Se"); I:=ExtFml("GV.GetVar","I"); N:=ExtFml("GV.GetVar","N"); X:=ExtFml("GV.GetVar","X"); Cn:=ExtFml("GV.GetVar","Cn"); Cp:=ExtFml("GV.GetVar","Cp"); Cx:=ExtFml("GV.GetVar","Cx"); En:=ExtFml("GV.GetVar","En"); Ex:=ExtFml("GV.GetVar","Ex"); Lb:=ExtFml("GV.GetVar","Lb"); Nd:=ExtFml("GV.GetVar","Nd"); Ns:=ExtFml("GV.GetVar","Ns"); Tr:=ExtFml("GV.GetVar","Tr"); Xd:=ExtFml("GV.GetVar","Xd"); Xs:=ExtFml("GV.GetVar","Xs"); A:=(Cp>0)/(Cp+(Cp=0)); If(Z=0,M, If(Z=1,100*(M-Cp)*A, If(Z=2,N+M-Cp-Cum(N), If(Z=3,100*(N+M-Cp-Cum(N))*A, If(Z=4,Cum((N>0)*N), If(Z=5,Cum((N<0)*N), If(Z=6,Cum(N>0), If(Z=7,Cum(Ex+Lb>0 AND N<=0), If(Z=8,Tr, If(Z=9,BarsSince(I OR Alert(Tr,2)=0)*Alert(Tr,2), If(Z=10,Cum(Alert(Tr,2)), If(Z=11,Ns,Nd)))))))))))); ---8<--------------------------- http://www.metastocktips.co.nz/