PureBytes Links
Trading Reference Links
|
Welcome back Roy
"A PREV based latch allows decisions to be made on actual entry related
values, and it can easily be structured to ignore secondary signals -
something that I don't think can be achieved without PREV."
There appear to be some limited circumstances where it's possible to
construct a non-PREV latch which ignores repeated entry signals. For
example, this code sets up an entry with a time stop exit and ignores a
single repeated entry signal. (This can be cut and pasted as a custom
indicator on any chart - just show the first 80 bars or so)
{Test - BarDiff}
{Demonstrates a non-PREV latch ignoring a repeated entry signal. Plots are
to demonstrate code line action. Not a trading system.}
{Andrew Tomlinson Jan 2005}
SignalIn:= Cum(1)=13 OR Cum(1)=15 OR Cum(1)=35 OR Cum(1)=57 OR
Cum(1)=63;SignalIn+30;
Init:= Cum(SignalIn>=-1)=1;Init+31.25;
TmStopL:=8;
BarDiff1:=ValueWhen(1,SignalIn OR Init, ValueWhen(1+1,1,BarsSince(SignalIn
OR Init))+1);BarDiff1;
{number of bars between the most recent two entry signals.}
Long:=If(BarDiff1<TmStopL,(BarsSince(SignalIn OR Init)+BarDiff1),
BarsSince(SignalIn OR Init))<TmStopL ;Long+32.5;
{if the entry signal is repeated within TmStopL bars, signal is ignored -
only works for one repeat}
EL:=Long AND Alert(Long=0,2);EL + 35;
CL:=Long=0 AND Alert(Long,2);(-CL) + 35;
{leading and trailing edges}
Note that the periods when the latch is open ("Long") are all the same
number of bars , despite repeated entry signals.
Most coding techniques from MSTT - thanks Roy! - with some steals from Jose.
The errors and inefficiencies are all mine..
Andrew
--- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
wrote:
> SP
>
> What's your definition of "straight forward"?
>
> I'm reasonably sure that the date of entry is unimportant, at least in
> terms of back-testing. What's important is being able to reference the
> bar on which the current trade was entered. You probably need a PREV
> based latch to do this. It will enable you to develop an exit based on
> your choice of values at the time of entry. You may need the buy
> signal to be indicator based, or otherwise to be compact enough to fit
> in the sell window along with the stop code.
>
> A PREV based latch allows decisions to be made on actual entry related
> values, and it can easily be structured to ignore secondary signals -
> something that I don't think can be achieved without PREV.
>
> If you're not optimising then both your buy and sell code can be
> indicator based. This leaves you with a lot more room to work with.
> Optimisation can be performed using code outside the System Tester
> too, but that's another story. (Planned for the March issue of MSTT).
>
> I'm sure there'll be a copy of my "Thanks for the Memory" document
> somewhere on the net, possibly in the files section of this group. The
> document includes exercises that take you through the process of
> creating simple and PREV-based latches. The January and February
> issues of MSTT cover much the same ground but with better
> illustrations.
>
> Is this "straight forward" enough for you? I've looked at the
> Simulation functions and can't see one that would easily adapt to your
> needs. Even if there was you may find that Simulation makes PREV look
> like greased lightning.
>
>
> Kind regards
>
> Roy Larsen
> www.metastocktips.co.nz
> Free formulas and MS links
>
>
>
> ----- Original Message -----
> From: "meta_scott" <no_reply@xxxxxxxxxxxxxxx>
> To: <equismetastock@xxxxxxxxxxxxxxx>
> Sent: Friday, January 21, 2005 9:41 AM
> Subject: [EquisMetaStock Group] referencing position entry date
>
>
> Is there a straight forward way to reference the date when a position
> was entered?
>
> This would be very useful in programming more sophisticated stops than
> the MS stops.
>
> Thanks,
>
> SP
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Has someone you know been affected by illness or disease?
Network for Good is THE place to support health awareness efforts!
http://us.click.yahoo.com/Rcy2bD/UOnJAA/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/
|