Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi Jonestock
Included below an adapted version of the "PS Meisels Overbought/Oversold" system that comes with the last several versions of MetaStock. My adaptation is in Indicator form so that Trade Equity indicators can call it to generate an equity curve and much more.
Below the system indicator is a basic version of the Trade Equity GV LE- "Trade Equity LE" without the assistance of Global variables. Its primary function is to develop an equity curve without the need to access the EST. Not only can the Trade Equity tools generate an equity curve but in the process of doing so they generate a range of statistics and can report those as plots on a chart and/or as an Expert commentary.
If you create both of the indicators below you should be able to plot an equity curve, and even match it to an EST equity curve using appropriate EST settings. Trade Equity LE usually requires Equal position sizing (as opposed to compounding position sizing where profits or losses are added to (subtracted from) available capital).
If you are interested you can get a copy of the Trade Equity User Guide and other supporting documents by writing to me at my "quik" email address from my previous post.
Roy
{PS MOO (Meisels Overbought/Oversold)}
M1:=Sum(If(C>Ref(C,-1),+1,If(C<Ref(C,-1),-1,0)),10);
EntryLong:=Cross(-6,M1) OR M1=-6;
EntryLong:=EntryLong*Alert(EntryLong=0,2);
ExitLong:=Cross(M1,0) OR M1=0;
ExitLong:=ExitLong*Alert(ExitLong=0,2);
EntryShort:=Cross(M1,6) OR M1=6;
ExitShort:=Cross(0,M1) OR M1=0;
Long:=EntryLong-ExitLong;
Short:=EntryShort-ExitShort;
Long;
{Trade Equity LE}
{Roy Larsen, 2003-2015, 27/1/15, v8.5.4}
{Inputs}
A:=Input("Trade Equity LE, 0=Long, 100=short, ",0,100,0);
B:=Input("Entry, 1=O 2=C 3=H 4=L 5=Stop",1,5,1);
Z:=Input("Exit, 1=O 2=C 3=H 4=L 5=Stop",1,5,1);
G:=Input("Entry Cost",0,999,25);
J:=Input("Exit Cost",0,999,25);
D:=Input("Entry/Exit Delays 00-99",0,99,11);
K:=10000; F:=-0.5;{Equity/Factor}
{Signals}
I:=Fml("PS MOO");
N:=I>0;
Ns:= 0;
X:=I<0;
Xs:= 0;
{Code}
Xd:=LastValue(Int(Frac(D/9.9)*10));
D:=LastValue(Int(D/10));Ns:=(B=5)*Ns;
F:=ValueWhen(1+D,1,If(Abs(F)>1,Abs(F),-F));
M:=If(Ns>0,Min(H,Max(L,Ns)),If(B=1,O,If(B=3,H,If(B=4,L,C))));
N:=N*(Alert(N=0,2)+(Cum(N>-1)=1));
X:=X*Alert(X=0,2)*(Z<5);
N:=ValueWhen(1+D,1,N);N:=If(B<5,N,Ns>0);
N:=If((F<=1)*(F>0)*(F*K<M),(K=0)*N,N);
Xs:=(Xs>0)*Min(H,Max(L,Xs));
Y:=If(Xs>0,Xs,If(Z=1,O,If(Z=3,H,If(Z=4,L,C))));
X:=ValueWhen(1+Xd,1,X);X:=X+Xs>0;
Y:=If((Z<5)*(X=0),C{Y},Y);Y:=If((Xs>0)*N*X,Xs,Y);
I:=Cum(Abs(F)+K+N+X>-1)=1;N:=(I>-1)*N;
Y:=If((N+X=0)*Alert(N*X,2),ValueWhen(2,1,Y),Y);
R:=BarsSince(I+N)<(BarsSince(I+X)+(Cum(N)=1 AND Cum(I+X)=1));
R:=If((N+X>1)*(Alert(R,2)+((D+Xd<1)
*(B<>2)*(Z>1)*(Max(B,Z)>4 OR B<>Z))),1,R);
U:=R*Alert(R=0,2)+I; {M:=If(I*(N=0),C,M);}
Rx:=Alert(R,2);Q:=Rx*(LastValue(Cum(1))=Cum(1));
Z:={Q+}(R=0)*Rx;
D:=A<99;
A:=ValueWhen(1,U,If(M,M,1));
F:=ValueWhen(1,U,If(F<0,K*Abs(F),
If(F<=1,Int((F*K-G)/A)*A+G,F*A+G)))*(K>0);
B:=Rx*(1+BarsSince(U));
I:=(F-G)*Y/A-F;U:=(F-G)*(A-Y)/A-G;
N:=(Z+Q>0)*If(D,If(K,I-J*Z,Y-A),If(K,U-J*Z,A-Y));
Xs:=Rx*If(D,If(K,I-Z*J,Y-A),If(K,U-Z*J,A-Y));
X:=Cum((Z+Q>0)*(N>0)*(B-1));Xd:=Cum((Z+Q>0)*(N<=0)*(B-1));
Cum(N)+K+R*(Q=0)*If(D,If(K,I,Y-A),If(K,U,A-Y));
|