PureBytes Links
Trading Reference Links
|
Jack
Here's long only code using my latest idea. 'M' is the critical variable.
I've adapted your ZZ code to create trade signals and prices but the nature
of the code means that the signal is one bar late. This in turn means that
the nominal first bar of the trade made exceed the 1% rise without being
detected. This would not be a problem if the entry (or exit) price was taken
from the same bar as the signal rather than from the bar of the peak or
trough.
You'll notice that I use ValueWhen() in preference to Ref() for delaying
prices, and Alert() for delaying binary signals. I do this because these
functions do not add extra N/A bars each time they're used. The 'I' bar is
useful for eliminating long initial N/A periods in certain uses of
ValueWhen.
Roy
{Long Trade Move}
X:=Input("Percent",0.2,100,10);
Z:=Zig(C,x,%);
last:=ValueWhen(1,(Z>Ref(Z,-1) AND Ref(Z,-1)<Ref(Z,-2))
OR (Z< Ref(Z,-1) AND Ref(Z,-1)>Ref(Z,-2)),
Ref(Z,-1));
{ZigZag generated entry signal and price}
N:=If(last<ValueWhen(2,1,last),ValueWhen(2,1,C),0);
{ZigZag generated exit signal and price}
X:=If(last>ValueWhen(2,1,last),ValueWhen(2,1,C),0);
{N:=If(Fml("PS Fractal Entry")>0,C,0);}
{X:=If(Fml("PS Fractal Exit")>0,C,0);}
{I provides initialisation for ValueWhen()}
I:=Cum(N+X>-1)=1;
{R is highest price since entry}
R:=If(PREV=0,N,If(C>PREV,Max(C,PREV),If(X>0,0,PREV)));
{A is the entry price}
A:=ValueWhen(1,I OR (R>0 AND Alert(R=0,2)),R);
{M is the percentage move above entry price}
M:=Int(100*(R>0)*(R-A)/If(A=0,0.0001,A));
{B signals a price move through a 1% boundary}
B:=R>0 AND M>ValueWhen(2,1,M);
{R;}
{M;}
B;
----- Original Message -----
From: "superfragalist" <j3ttt@xxxxxxxxxxx>
To: <equismetastock@xxxxxxxxxxxxxxx>
Sent: Friday, July 25, 2003 4:40 PM
Subject: [EquisMetaStock Group] ZigZag and mutual funds
> Hi Roy,
>
> I trade mutual funds all the time. I've developed a pretty good
> system for trading them. If you want to email me directly I will be
> glad to share what I did and why I do it. You can test the system and
> see if you like it. Unfortunately, with the market going sideways my
> mutual fund trading has given way to day trading for awhile.
>
> Backtesting with a peak and trough system doesn't get you much as you
> know because of the false and invisible signals. MS supplies a couple
> of peak and trough systems in their system tester and they always
> come out as one of the top systems. I would imagine all of the new MS
> users get really excited.
>
> I will keep working with the code you've sent. There's got to be a
> way to do this.
>
> Jack
>
>
>
> --- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
> wrote:
> > Jack
> >
> > As long as you're aware of the ZZ problems then it's up to you how
> you use
> > it and any related functions.
> >
> > About three years ago I back-tested a peak/trough based system
> designed for
> > mutual funds on my EOD stock database. The results were better than
> anything
> > I had seen up to that time so I re-tested each days entries right
> through a
> > two year period. About 45% of the entry signals when there was no
> forward
> > data disappeared once more data was added. The same problem may be
> much less
> > of an issue in other markets but I'm not a fan of the "random
> entry" method
> > and I came to the conclusion that ZigZag is definitely not for me.
> >
> > Sorry I can't be more constructive. I'm still interested in solving
> the
> > underlying problem of picking up a series of specific price
> movements but
> > I'm uncomfortable about using ZZ based function outputs as
> reference points
> > for the initial price. Irrational perhaps, but I guess we all have
> our
> > foibles. I've found that a PREV based latch has myriad uses in MS,
> I just
> > haven't figured out how to use it to get accurate signals for 1%
> moves.
> >
> > Roy
> >
> > > Thanks for the help on the code, Roy. I hope to have a pretty good
> > > working code shortly.
> > >
> > > I'm aware of the dynamic nature of the zigzag, especially on EOD
> > > data. I've read dozens of articles on it and various ways to
> handle
> > > the problems it can create. On intraday screens like 1, 5, 15 and
> 30
> > > minute time frames, I've tracked a zigzag function based on peak
> and
> > > trough bars and have found the movement of the indicator to be
> > > reasonable at the shorter distances between the price and the
> swing
> > > point, 1%, 2%, etc. The false readings and shifts seemed to be
> > > minimal. Obviously on those small distances you would get a lot of
> > > false trend changes. In this case 1% is my starting point. For
> what
> > > I'm doing it may drop to as low as 0.25%.
> > >
> > > On a few occasions I have recorded the first sign of the zigzag
> > > signal and then how many stayed stable intially and then how long
> it
> > > took for the rest to find their stablility point. Basically, the
> data
> > > I have collected seems to suggest that at the short distances and
> in
> > > tighter time frames, the dynamic nature of the indicator does not
> > > pose much of a problem. (At least that's what I've come up with. I
> > > may not have done my data collection properly. It's a little
> tricky.)
> > >
> > > Based on that and the fact that this portion of the expert is not
> > > giving entry signals, just approximate price changes, I thought it
> > > would work well enough in this application. However, I would like
> to
> > > find another method of doing the same thing, if I can work out the
> > > code.
> > >
> > > I'll keep playing around with what you've given me and see where I
> > > can take it. I'm not the best programmer. Everything has to be
> > > learned by trial and error because the information MS provides is
> so
> > > minimal.
> > >
> > > I certainly agree with you that the zigzag should never be used on
> > > EOD and for back testing a system. That's worthless. However, I
> have
> > > noticed a lot of commentary on this board and other boards that
> lead
> > > me to believe a lot of people have a negative view of the peak,
> > > trough and zigzag, yet they don't really understand under what
> > > context their views should apply. I guess everyone interprets
> > > whatever they've read as gospel without doing any application
> testing
> > > themselves. I suppose the topic is always debatable. I've read a
> few
> > > comments that have lead me to believe the debate is over, and all
> the
> > > definitive analysis has been done--end of story. I don't think so,
> > > but I'll never change their minds.
> > >
> > > Those invisible zigzag signals are always hard to deal with, but
> one
> > > of the tests I've done is to capture live charts with the peak and
> > > trough function alone and with validated peak and trough functions
> > > for comparison. Those results are interesting.
> > >
> > > Thanks again for helping. I'm getting to be a better all the time
> but
> > > it's slow going. I have a lot ideas I can't code up yet so I have
> to
> > > do things in a much less efficient way.
> > >
> > > Jack
> > >
> > >
> > >
> > >
> > > --- In equismetastock@xxxxxxxxxxxxxxx, "Roy Larsen" <rlarsen@xxxx>
> > > wrote:
> > > > Jack
> > > >
> > > > I don't think using ZigZag is a good idea. Even if you get code
> > > that appears
> > > > to do just what you want the dynamic nature of ZZ makes it
> > > virtually useless
> > > > IMO.
> > > >
> > > > I feel that using rock solid code like that below to track
> prices
> > > moving
> > > > favourably is a better way to go. I haven't cracked how to
> signal
> > > moves
> > > > across new 1% boundaries yet, but once the entry price is
> locked in
> > > it's
> > > > just a technicality. The solution won't be too far away.
> > > >
> > > > {Long Trade Move}
> > > > N:=If(Fml("PS Fractal Entry")>0,C,0);
> > > > X:=If(Fml("PS Fractal Exit")>0,C,0);
> > > > Tl:=If(PREV<=0,N,If(C>PREV,Max(C,PREV),If(X>0,0,PREV)));
> > > > El:=Valuewhen(1,Tl>0 and Alert(Tl=0,2),Tl);
> > > > Tl; El;
> > > > {Short Trade Move}
> > > > Ts:=If(PREV=0,X,If(C<PREV,Min(C,PREV),If(N>0,0,PREV)));
> > > > Es:=Valuewhen(1,Ts>0 and Alert(Ts=0,2),Ts);
> > > > Ts; Es;
> > > >
> > > > Roy
> > > >
> > > > > The problem with what I wrote is it doesn't produce an exact
> > > > > crossover at the grid lines. In other words it passes across a
> > > grid
> > > > > line without ever having an exact value of 1.0, for example.
> The
> > > > > reason is the time frame. If it's a five minute chart the next
> > > bar on
> > > > > a five minute chart is five minutes away which means the
> indicator
> > > > > value jumps from where it was at bar1 to where it is at bar2,
> five
> > > > > minutes apart. It makes it tough to find a formula that
> captures
> > > the
> > > > > right values.
> > > > >
> > > > > For whatever reason the indicator does not work on a 1 minute
> > > chart,
> > > > > so that's not an option. It works good on 10 min and 15 min
> > > charts.
> > > > >
> > > > > What do you think!
> > > > >
> > > > > Jack
> > > > >
> > > > >
> > > > >
> > > > > 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/
> > > > >
> > > > >
> > > > >
> > >
> > >
> > >
> > > 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/
> > >
> > >
> > >
> > >
>
>
>
> 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/
>
>
>
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges & Refill Kits for Your Epson at Myinks.com
Free shipping on orders $50 or more to the US and Canada.
http://www.c1tracking.com/l.asp?cid=5705&lp=home/epson.asp
http://us.click.yahoo.com/brYXfA/_xWGAA/ySSFAA/BefplB/TM
---------------------------------------------------------------------~->
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/
|