[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [EquisMetaStock Group] Re: Entry testing code issues



PureBytes Links

Trading Reference Links

Jose

1. What is the function of the cum(set)=1 in Trigger1 and it's equivalent in
Trigger 3? I know it refers to the first occurrence of "set" within the
selected data, but that's as far as I get. Is it related in some way to the
initialization variable? But that's already referred to in the statement, so
the earliest occurrences have been validated. I do notice that your code
starts later than the original (on the data I was using my first trade is a
short).

2. I liked the non-PREV code for "short", so I tried using it for "long"
too. This seems to work, as 

long:= BarsSince(Init OR Set)
 <BarsSince(Init OR Reset OR TStopL)
 +(Cum(Set)=1);

giving a completely PREV free code! It looks ok on my test case. Am I
missing anything?

Best
Andrew



-----Original Message-----
From: Jose [mailto:josesilva22@xxxxxxxxx] 
Sent: Tuesday, June 29, 2004 10:06 PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: [EquisMetaStock Group] Re: Entry testing code issues



Andrew, you can get rid of at least 6 of the 8 PREV functions in your 
code, as well as some redundant code, with the code below which gives 
identical signals to the sloooow original.

---8<----------------

{ Single MA System }
{ Entry: slope of MA changes in one bar. }
{ Exit: reverse of Entry }

B1:=Input("EMA periods",1,300,50);
B2:=Input("TStop periods",1,100,10);

MA:=Mov(C,B1,E);
Set:=Cross(C,MA);
Reset:=Cross(MA,C);
Init:=Cum(Set+Reset>-1)=1; {thanks Roy}

Trigger1:=BarsSince(Init OR Set)
 <BarsSince(Init OR Reset)+(Cum(Set)=1);

TStopL:=If(Trigger1,
 BarsSince(ROC(Trigger1,1,$)>0)=B2,0);

long:=If(PREV=0,Set,
 If(Reset OR BarsSince(PREV=0)>=B2,0,1));

Trigger3:=BarsSince(Init OR Reset)
 <BarsSince(Init OR Set)+(Cum(Reset)=1);

TStopS:=If(Trigger3,
 BarsSince(ROC(Trigger3,1,$)>0)=B2,0);

short:=BarsSince(Init OR Reset)
 <BarsSince(Init OR Set OR TStopS)
 +(Cum(Reset)=1);

long-short

---8<----------------


jose '-)
http://users.bigpond.com/prominex/pegasus.htm



--- In equismetastock@xxxxxxxxxxxxxxx, "Andrew Tomlinson" 
<andrew_tomlinson@xxxx> wrote:
> 
> I am writing some code to follow Le Beau's strategy for testing
Entries in
> "Computer Analysis of the Futures Markets" - i.e. test a bunch of
entries
> using with the only exits being time stops and compare to a random
entry. I
> am therefore assuming an entry as per the system, and an exit as the
earlier
> of a system reversal or a time stop.
> 
> For a long and short system, I am ending up with code with 4 PREV
latches. I
> can't get the indicator exit and the time stop in the same latch
since the
> time stop needs to refer to the prior latch to set the clock
running. This
> seems to work, but it feels clumsy - is there a better way?
> 
> Here's an example, written as an indicator which will show long
positions as
> +1, short as -1 and time out of the market as 0. The entry is on the
slope
> of a moving average. I've annotated the long side for clarity. Short
is just
> the opposite of long. I have included entry and exit signals for use
in
> TE/TradeSim/System Tester although they're not actually used in the 
> Indicator. Ideally I'm trying to get to a baseline code that I can
use to
> quickly compare different entries. [NB this is not a tradable system
-it
> cuts off trends way too early- just an exercise to compare different 
> entries]
> 
> Thanks for your thoughts
> Andrew
> 
> 
----------------------------------------------------------------------
------
> ---------------------------
> 
> {Single MA System - gives entry signals when slope of MA changes to
up or
> down in one day. Exit is a reverse signal or a time stop. Indicator.
}
> 
> 
> B1:= Input("Enter bars for MA1",1,300,50);
> B2:= Input("Enter bars for TStop",1,100,10);
> 
> MA:=  Mov(C,B1,E);         {today's MA}
> MA1:= Ref(Mov(C,B1,E),-1); {yesterday's MA}
> MA2:= Ref(Mov(C,B1,E),-2); {day before yesterday's MA}
> 
> Set:=   MA2>=MA1 AND MA1<MA;   {MA turns up}
> Reset:= MA2<=MA1 AND MA1>MA;   {MA turns down}
> 
> Trigger1:= If(PREV=0,If(Set,1,0),If(Reset,0,PREV)); 
>      {first binary trigger for set and reset signals} 
> TStopL:=if(Trigger1=1,if(barssince(roc(Trigger1,1,$)>0)=B2,1,0),0);
>      {time stop keying off Trigger1}
> Trigger2:= If(PREV=0,If(Set,1,0),If(Reset OR TStopL,0,PREV));
>      {second binary trigger to include time stop} Long:=Trigger2;
> 
> EL:=if(ref(long,-1)=0,if(set,1,0),0); 
>     {Enter Long if you're out of the market and get an indicator
buy}
> CL:=if(ref(long,-1)=1,if(Reset OR TStopL,-1,1),0);
>     {Close Long on an indicator sell or time stop}
> 
> 
> Trigger3:= If(PREV=0,If(Reset,1,0),If(Set,0,PREV));
> TStopS:=if(Trigger3=1,if(barssince(roc(Trigger3,1,$)>0)=B2,1,0),0);
> Trigger4:= If(PREV=0,If(Reset,1,0),If(Set OR TStopS,0,PREV)); 
> Short:=Trigger4;
> 
> ES:=if(ref(short,-1)=0,if(Reset,1,0),0);
> CS:=if(ref(short,-1)=1,if(Set OR TStopS,-1,1),0);
> 
> Long - Short; {i.e., will show +1 for long market position, -1 for
short and
> 0 for out}





 
Yahoo! Groups Links



 




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BefplB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/equismetastock/

<*> To unsubscribe from this group, send an email to:
     equismetastock-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/