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 turtlet
I can't solve your problem unless ALL system parameters are available. I have to be able to set up the system the way you have before I can track down the problem. The code part is easy; it's one or more of the many other settings that that's the problem. Can you print the System page when looking at results (print to PDF if possible - CutePDF should do that). Printing all other result pages should also work, though from memory I think all formatting of those pages gets lost in when printed.
Here's an indicator that plots an equity curve for you system. Getting the EST to plot an identical equity curve is something of a mission but it can be done when both this indicator and the EST are set up appropriately. The Global Variable version of the Trade Equity LE indicator enables the use of the Explorer for multiple securities, and the results can be displayed as an Expert Commentary. email me at rlarsen@quik.co.nz and I'll see what other help I can give. Keep in mind that my time is limited and I'm probably in a quite different time zone as well.
The first formula is yours with bits added to provide both entry and exit signals where TE inputs are restricted to just one formula.
Roy
{Slope of EMA System}
{code converted to TE format }
M:=Mov(C,13,E)>Ref(Mov(C,13,E),-1) AND Ref(Mov(C,13,E),-1)>Ref(Mov(C,13,E),-2);
Entry:=M*Alert(M=0,2);
Exit:=(M=0)*Alert(M,2);
Entry-Exit;
{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,2);
Z:=Input("Exit, 1=O 2=C 3=H 4=L 5=Stop",1,5,2);
G:=Input("Entry Cost",0,999,0);
J:=Input("Exit Cost",0,999,0);
D:=Input("Entry/Exit Delays 00-99",0,99,11);
K:=1000; F:=-1;{Equity/Factor}
{Signals}
I:=Fml("Slope of EMA System");
N:=I>0; {Binary entry signal}
Ns:= 0; {Price entry signal}
X:=I<0; {Binary exit signal}
Xs:= 0; {Price exit signal}
{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));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