PureBytes Links
Trading Reference Links
|
Yes, but.... If you 'parameterise' the thing, it is very easy to
change it at a later stage. So if you use a different rule, and wish
to only start testing the system after 50 days, once the indicators
settle down, then you just change
setbars:=3
to
setbars:=50
somewhere and you are done. Anyhow, this is just a refinement, you
can discard it or 'hardcode' it (ie not use parameters) as you point out.
Regards
MG Ferreira
TsaTsa EOD Programmer and trading model builder
http://www.ferra4models.com
http://fun.ferra4models.com
--- In equismetastock@xxxxxxxxxxxxxxx, "dpleydel" <dpleydel@xxxx> wrote:
>
>
> Hi,
>
> RE:
> New version
> -----------
> isLong := (Cum(1)>=setbars) AND (ff<=Ref(ff,-1)) AND (ss>=Ref(ss,-1));
>
> This is what confuses me. Why you would do cum(1)>=setbars in this
> context.Since setbars = 3 isn't it (Cum(1)>=3) which always is going
> to be true once we have had 3 trading days?
>
> Which really means the test is only based on (ff<=Ref(ff,-1)) AND
> (ss>=Ref(ss,-1))?
>
> David
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "MG Ferreira" <quant@xxxx>
> wrote:
> >
> > Hi David,
> >
> > > Thanks for the replies. The example of cum(5) = 5 helps as I see
> > > the parameter is the increment?
> >
> > No problem. The parameter is indeed the increment. Note that it
> > need not be a constant, but you could have
> >
> > CC := cum(CLOSE)
> >
> > to have
> >
> > CC(t) := CC(t-1) + CLOSE(t)
> >
> > You could even use a formula, say you want to calculate a volume
> > weighted average, you can do something like
> >
> > CUM(CLOSE*VOLUME)/CUM(VOLUME)
> >
> > Just some off-the-cuff examples, they may very well contain some
> bugs....
> >
> > > {long}
> > > setbars:=3;
> > > entryadd:=1;
> > > ff:=Mov(Stoch(7,1),3,E);
> > > ss:=Mov(Mov(Stoch(16,1),3,E),3,E);
> > > cbuy:=If(ff<=Ref(ff,-1) AND ss>=Ref(ss,-1),Cum(1),0);
> > > bbuy:=If(cbuy>=setbars,H+entryadd, 99999);
> > > bbuy<99999
> >
> > In terms of this, I think the heart of it is locked up in the last
> > three lines, so let us look at them, but I'll start from the last
> > one and work my way backwards! I think this will make things more
> > clear actually....
> >
> > > bbuy<99999
> >
> > This line basically returns a TRUE or FALSE, a yes or no if you
> want.
> > True if we are long, false if not. Note that it really hangs on
> just
> > one value, 99999. This value is just used as a type of a flag, so
> if
> > bbuy is equal to (or exceeds) this value, we are out.
> >
> > > bbuy:=If(cbuy>=setbars,H+entryadd, 99999);
> >
> > The second to last line sets this flag. If cbuy equals or exceeds
> > setbars then bbuy becomes H (High) + entryadd, probably the cost
> > plus some slippage. Otherwise, the flag value of 99999 is assigned
> > and we are out.
> >
> > > cbuy:=If(ff<=Ref(ff,-1) AND ss>=Ref(ss,-1),Cum(1),0);
> >
> > Here we have the actual decision rule. If ff is falling and ss is
> > rising, cbuy takes on the ever-increasing cum(1) value, otherwise it
> > will take on zero.
> >
> > Now, here is a different way of writing the same code that will
> > make things a lot clearer I think. Note that I have liberally
> changed
> > names and stuff to deliberately make it clearer. Again, some bugs
> may
> > remain. Please review the disclaimer.
> >
> > Original version
> > ----------------
> > > cbuy:=If(ff<=Ref(ff,-1) AND ss>=Ref(ss,-1),Cum(1),0);
> > > bbuy:=If(cbuy>=setbars,H+entryadd, 99999);
> > > bbuy<99999
> >
> > New version
> > -----------
> > isLong := (Cum(1)>=setbars) AND (ff<=Ref(ff,-1)) AND (ss>=Ref(ss,-
> 1));
> > costLong := isLong * ( HIGH + entryadd );
> > isLong
> >
> > Regards
> > MG Ferreira
> > TsaTsa EOD Programmer and trading model builder
> > http://www.ferra4models.com
> > http://fun.ferra4models.com
> >
> >
> >
> >
> >
> > --- In equismetastock@xxxxxxxxxxxxxxx, "dpleydel" <dpleydel@xxxx>
> wrote:
> > >
> > >
> > > Thanks for the replies. The example of cum(5) = 5 helps as I see
> > > the parameter is the increment?
> > >
> > > This is the full code I was trying to understand: (it's Linda
> > > Bradfords - Anti Indicator)
> > >
> > > {long}
> > > setbars:=3;
> > > entryadd:=1;
> > > ff:=Mov(Stoch(7,1),3,E);
> > > ss:=Mov(Mov(Stoch(16,1),3,E),3,E);
> > > cbuy:=If(ff<=Ref(ff,-1) AND ss>=Ref(ss,-1),Cum(1),0);
> > > bbuy:=If(cbuy>=setbars,H+entryadd, 99999);
> > > bbuy<99999
> > >
> > > Hence why I didn't understand why you would want to just
> accumlate
> > > the periods, like if it was period 100, 101, 103 etc as the test
> > > where cbuy >=3(setbar) seems strange as cum(1) will always be
> > > greater once we have more than 3 days (so the setbar seems
> > > unnecessary) unless as per your example where a mod functions was
> > > used to reset the sequence.
> > >
> > > David
> > >
------------------------ Yahoo! Groups Sponsor --------------------~-->
What would our lives be like without music, dance, and theater?
Donate or volunteer in the arts today at Network for Good!
http://us.click.yahoo.com/Tcy2bD/SOnJAA/cosFAA/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/
|