PureBytes Links
Trading Reference Links
|
This is interesting. Are you proposing putting the Init at a later stage in
the code process, or are you repeating Init with a different definition,
i.e. in this case
Init:= Cum(SignalIn>=-1)=1
BarDiff1:=ValueWhen(1,SignalIn OR Init,
ValueWhen(1+1,1,BarsSince(SignalIn OR Init))+1);BarDiff1;
Init:= Cum(BarDiff1>=-1)=1;
Thus a multi-stage code might have several levels of Init?
What I usually do is to list all my variables at the beginning of the code
(e,g, elements of entry and exit code) and then include as many as make
sense into one big Init statement.
Thanks
Andrew
-----Original Message-----
From: Roy Larsen [mailto:rlarsen@xxxxxxxxxxxxxx]
Sent: Friday, January 21, 2005 6:15 PM
To: equismetastock@xxxxxxxxxxxxxxx
Subject: Re: [EquisMetaStock Group] Re: referencing position entry date
Hi Andrew
You can see the potential for a problem by plotting the code on a chart and
looking where the
various signals start. Two plots start on bar one and the other four start
on bar two. Init is one
that starts on bar one.
If Init is true while some other code component it is grouped with is N/A
then its usefulness might
be lost. It's apparently not an issue with your code, but it could be in a
different situation.
Setting up an Init early is good; just be aware that it may need to be
modified subsequently. If it
did need adjusting for subsequent variables then this is how I would do it.
BarDiff1:=ValueWhen(1,SignalIn OR Init,
ValueWhen(1+1,1,BarsSince(SignalIn OR Init))+1);BarDiff1;
Init:= Cum(BarDiff1>=-1)=1;
Since it doesn't seem to be a problem forget I mentioned it.
Kind regards
Roy
www.metastocktips.co.nz
----- Original Message -----
From: "Andrew Tomlinson" <andrew_tomlinson@xxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Saturday, January 22, 2005 11:07 AM
Subject: RE: [EquisMetaStock Group] Re: referencing position entry date
> "The use of ValueWhen(1+1,1... introduces an N/A plot a little further
> down" You did confuse me!
>
> I tried plotting the following, to see if it had any gaps, but it
> seemed OK: IsDefined(ValueWhen(1+1,1,BarsSince(SignalIn OR Init))+1);
> It is defined from Init, as one would expect.
>
> How can I see this problem in action? I'd like to plot it vs. Ref() so
> I can see which is less problematical..or is there another solution?
>
> Best
> Andrew
>
>
> -----Original Message-----
> From: Roy Larsen [mailto:rlarsen@xxxxxxxxxxxxxx]
> Sent: Friday, January 21, 2005 4:32 PM
> To: equismetastock@xxxxxxxxxxxxxxx
> Subject: Re: [EquisMetaStock Group] Re: referencing position entry
> date
>
>
>
> 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 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 Links
------------------------ 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/
|