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

Re: [EquisMetaStock Group] Re: referencing position entry date



PureBytes Links

Trading Reference Links

Hi Andrew

> "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)

You're right. I guess the real problem for me is that a non-PREV latch can't use the entry-related 
information to manage an exit. I'm assuming of course that the stop SP envisaged was entry related. 
Unless he responds I guess we'll never know.

Just a small point about your Init signal on bar one. The use of ValueWhen(1+1,1... introduces an 
N/A plot a little further down. The effect this has on the "Long" variable is that Init is invalid 
just when you might need it. I may have indicated in the newsletter that ValueWhen() wouldn't do 
this, but at the left side of the chart it's as vulnerable as any other function. The "Nth" and 
"parameter" values determine when ValueWhen is clear of the problem area. For ValueWhen(5,1,X) it 
would be the fifth bar. I hope I haven't confused you.


Kind regards

Roy
www.metastocktips.co.nz


> {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 Links
>
>  a.. To visit your group on the web, go to:
>  http://groups.yahoo.com/group/equismetastock/
>
>  b.. To unsubscribe from this group, send an email to:
>  equismetastock-unsubscribe@xxxxxxxxxxxxxxx
>
>  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
> 




------------------------ 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/