PureBytes Links
Trading Reference Links
|
Andrew, for all practical purposes, your amended entry/exit signals
are almost identical to:
entry:=C>Mov(C,10,E);
exit:=C<Mov(C,21,E);
This makes it very unlikely that an exit signal will appear before an
entry, so the trade binaries for your system example will be
identical.
The answer to your question is then "yes", your particular example
precludes any differences in the trade binary or flag output.
However, try "signals" instead of "flag" for the last line of code,
and the missing first trade signal will then become apparent.
jose '-)
--- In Metastockusers@xxxxxxxxxxxxxxx, "Andrew Tomlinson"
<andrew_tomlinson@xxxx> wrote:
> I'm missing something. I can get the same results as the trade
> binary signals in the "new" formulation, while still using
> barssince, by a small change in the entry/exit inputs to the second
> formula, as follows:
>
> -------------------------------------------
> entry:=C>Mov(C,21,E) AND C>Mov(C,10,E);
> exit:=C<Mov(C,10,E) AND C<Mov(C,21,E);
>
> Init:=Cum(entry+exit>-1)=1;
> entryInit:=Cum(entry)=1;
> flag:=BarsSince(Init OR entry)
> <BarsSince(Init OR exit)+entryInit;
> signals:=(entryInit AND Alert(entryInit=0,2)
> OR flag AND Alert(flag=0,2))
> -(flag=0 AND Alert(flag,2));
> flag;
> -------------------------------------------
>
> Is this just a product of this particular example?
>
> Andrew
>
>
>
> -----Original Message-----
> From: Jose [mailto:josesilva22@x...]
> Sent: Friday, February 11, 2005 10:04 AM
> To: Metastockusers@xxxxxxxxxxxxxxx
> Subject: [Metastockusers] A better trade binary
>
>
> I recently stumbled on an improvement to the basic trade binary
> code, which allows the use of ValueWhen() instead of BarsSince()
> MetaStock functions.
>
> Avoiding the BarsSince() function means that the indicator code now
> does not need to wait for the first entry signal before plotting an
> exit signal. This is best illustrated by plotting and comparing the
> two trade signal indicators below.
>
>
> MetaStock -> Tools -> Indicator Builder -> New ->
> Copy and paste complete formulae between "---8<---" lines.
>
>
> ====================
> System trade signals
> ====================
> ---8<--------------------------
>
> { System trade signals - note: simultaneous
> Long/Short signals cancel each other }
> { http://www.metastocktools.com }
>
> { Signals reference example }
> entry:=C>Mov(C,21,E);
> exit:=C<Mov(C,10,E);
>
> { User inputs }
> plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1);
> delay:=Input("Entry and Exit delay",-1,5,0);
>
> { Clean signals }
> x:=ValueWhen(1,entry-exit<>0,entry-exit);
> long:=x=1
> AND (Alert(x<>1,2) OR Cum(IsDefined(x))=1);
> short:=x=-1
> AND (Alert(x<>-1,2) OR Cum(IsDefined(x))=1); signals:=long-short;
> binary:=ValueWhen(1,signals<>0,signals);
>
> { Plot in own window }
> Ref(If(plot=1,signals,
> If(plot=2,entry-exit,binary)),-delay)
>
> ---8<--------------------------
>
>
> ===============================
> System trade signals - original
> ===============================
> ---8<--------------------------
>
> { Original trade signals code }
> { BarsSince() function prevents first exit plot}
> { With thanks to Roy Larsen at
> http://www.metastocktips.co.nz }
>
> { Signals reference example }
> entry:=C>Mov(C,21,E);
> exit:=C<Mov(C,10,E);
>
> { User inputs }
> plot:=Input("Signals: [1]Clean, [2]All, [3]Trade binary",1,3,1);
> delay:=Input("Entry and Exit delay",-1,5,0);
>
> { Clean signals }
> Init:=Cum(entry+exit>-1)=1;
> entryInit:=Cum(entry)=1;
> flag:=BarsSince(Init OR entry)
> <BarsSince(Init OR exit)+entryInit;
> signals:=(entryInit AND Alert(entryInit=0,2)
> OR flag AND Alert(flag=0,2))
> -(flag=0 AND Alert(flag,2)); binary:=ValueWhen(1,signals<>0,
signals);
>
> { Plot in own window }
> Ref(If(plot=1,signals,
> If(plot=2,entry-exit,binary)),-delay)
>
> ---8<--------------------------
>
>
> jose '-)
> http://www.metastocktools.com
------------------------ 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/zMEolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/Metastockusers/
<*> To unsubscribe from this group, send an email to:
Metastockusers-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|