PureBytes Links
Trading Reference Links
|
Dimitris
I have to say I am as impressed with this as I am with the Athens Olympics.
Thank you for the time and effort you put into this.
The second group of formulae are a lot faster than the first.
Seems to work well on some charts, less well on others.
It seems that the selection of the initial trough is the critical thing here.
I need to find a way to alter the last trough selection point. There is a lot of code here for this newbie to get his head around, but I will play with this and see if I can get the hang of it.
Thank you again
Chrisb
DIMITRIS TSOKAKIS <TSOKAKIS@xxxxxxxxx> wrote:
And here is the complete formula
//Best-fit parabolics
Plot(C,"C",1,64);
perc=5;//sensitivity calibration
x=BarIndex();xx=LastValue(x);
//Best-fit parabolic from the last Peak
t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x));
H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H));
PlotShapes(shapeDownArrow*(x==t1),colorRed);
t=x-t1;diff1=H1*(xx-t1);f1=0;f2=2;fa=0;fb=0;step=0.01;
for(f=f1;f<f2;f=f+step)
{
parabolic=H1-f*t^2;
diff=LastValue(Sum(abs(parabolic-H),xx-t1));
if(diff<diff1)
{
diff1=diff;fa=f;
}
}
for(f=Max(fa-step,0);f<fa+step;f=f+0.1*step)
{
parabolic=H1-f*t^2;
diff=LastValue(Sum(abs(parabolic-H),xx-t1));
if(diff<diff1)
{
diff1=diff;fb=f;
}
}
Plot(IIf(x>t1,H1-fb*t^2,-1e10),"",colorRed,1);
//Best-fit parabolic from the last Trough
t11=LastValue(ValueWhen(TroughBars(L,perc)==0,x));
H11=LastValue(ValueWhen(TroughBars(L,perc)==0,L));
PlotShapes(shapeUpArrow*(x==t11),colorBrightGreen);
t=x-t11;diff11=H11*(xx-t11);f11=0;f21=2;fa1=0;fb1=0;step=0.01;
for(f=f11;f<f21;f=f+step)
{
parabolic1=H11+f*t^2;
diff1=LastValue(Sum(abs(parabolic1-L),xx-t11));
if(diff1<diff11)
{
diff11=diff1;fa1=f;
}
}
for(f=Max(fa1-step,0);f<fa1+step;f=f+0.1*step)
{
parabolic1=H11+f*t^2;
diff1=LastValue(Sum(abs(parabolic1-L),xx-t11));
if(diff1<diff11)
{
diff11=diff1;fb1=f;
}
}
Plot(IIf(x>t11,H11+fb1*t^2,-1e10),"",colorBrightGreen,1);
Title=Name() +", f_desc="+WriteVal(fb,1.3)+", f_asc="+WriteVal
(fb1,1.3);
The most recent line is the most important.
Dimitris
PS:Another interesting idea would be to plot parabolics from Peak to
Trough and from Trough to Peak.
Any thoughts ?
--- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
wrote:
> The following code will be 10 times faster
>
> //The best-fit parabolic after the last peak
> Plot(C,"C",1,64);perc=5;
> x=BarIndex();xx=LastValue(x);
> t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x));
> H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H));
> PlotShapes(shapeDownArrow*(x==t1),colorRed);
> t=x-t1;diff1=H1*(xx-t1);f1=0;f2=2;fa=0;fb=0;step=0.01;
> for(f=f1;f<f2;f=f+step)
> {
> parabolic=H1-f*t^2;
> diff=LastValue(Sum(abs(parabolic-H),xx-t1));
> if(diff<diff1)
> {
> diff1=diff;fa=f;
> }
> }
> for(f=Max(fa-step,0);f<fa+step;f=f+0.1*step)
> {
> parabolic=H1-f*t^2;
> diff=LastValue(Sum(abs(parabolic-H),xx-t1));
> if(diff<diff1)
> {
> diff1=diff;fb=f;
> }
> }
> Plot(IIf(x>t1,H1-fb*t^2,-1e10),"",colorRed,1);
> Plot(IIf(x>t1,H1-Max(fa-step,0)*t^2,-1e10),"",colorBlack,1);
> Plot(IIf(x>t1,H1-(fa+step)*t^2,-1e10),"",colorBlack,1);
> Title=Name()+", fa="+WriteVal(fa,1.3)+", fb="+WriteVal(fb,1.3);
>
> fa is the first approximation [2 decimals] and fb is the most
> accurate [3 decimals]
> The [red] best-fit parabola and the [black] nearest neighbours
appear
> on the price chart.
> Dimitris
>
> --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
<TSOKAKIS@xxxx>
> wrote:
> > Chrisb,
> > Since my previous references are mostly Fib oriented, here is the
> > best-fit parabola after the most recent peak.
> > The criterion is to make the Sum of abs(parabolic-H) minimum.
> >
> > //The best-fit parabolic after the last peak
> > Plot(C,"C",1,64);perc=5;
> > x=BarIndex();xx=LastValue(x);
> > t1=LastValue(ValueWhen(PeakBars(H,perc)==0,x));
> > H1=LastValue(ValueWhen(PeakBars(H,perc)==0,H));
> > PlotShapes(shapeDownArrow*(x==t1),colorRed);
> > t=x-t1;diff1=H1*(xx-t1);f1=0.001;f2=2;
> > for(f=f1;f<f2;f=f+0.001)
> > {
> > parabolic=H1-f*t^2;
> > diff=LastValue(Sum(abs(parabolic-H),xx-t1));
> > if(diff<diff1)
> > {
> > diff1=diff;f1=f;
> > }
> > }
> > Plot(IIf(x>t1,H1-f1*t^2,-1e10),"",colorRed,1);
> > Title=Name()+", f1="+WriteVal(f1,1.3);
> >
> > In general we need a range [0.001-2] for the coefficient f, MSFT
is
> > 0.005, ^NDX is 0,164 and ^N225 is 1,115 [f is obviously depended
on
> > the price values...]
> > This will make the general formula relatively slow .
> > Note also that the best-fit coefficient will change every new
day...
> > I think you can make a start towards the parabolic fitting.
> > A similar formula will give the best-fit parabola from the last
> > trough.
> >
> > Dimitris
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "DIMITRIS TSOKAKIS"
> <TSOKAKIS@xxxx>
> > wrote:
> > > Chrisb,
> > > I see, you put the peak/trough of the parabola at the local
price
> > > peak/trough...
> > > I have already posted some attempts, see #65462, 65440, 65437,
> > 65428
> > > of this list, it may help...
> > > Dimitris
> > > --- In amibroker@xxxxxxxxxxxxxxx, kris45mar <kris45mar@xxxx>
> wrote:
> > > >
> > > > Dimitris:
> > > >
> > > >
> > > >
> > > > Thank you for your interest in this.
> > > >
> > > >
> > > >
> > > > I suppose the parabolic trend line is a bit like all trend
> lines:
> > > you draw it on the chart and adjust it manually for a "best
fit."
> > > >
> > > >
> > > >
> > > > It hasn't taken me long in AB to just flick through my watch
> list
> > > and eyeball the charts for a parabolic price rise and then just
> try
> > > and fit the Arc Draw tool.
> > > >
> > > >
> > > >
> > > > I do notice that the Arc Draw tool can be moved and resized a
> bit
> > > to get the "best fit". I don't suppose that squashing the Arc
> Draw
> > > tool would alter the basic exponential shape of the curve, but
> that
> > > is way beyond my maths knowledge. What I mean is, assuming the
> > curve
> > > is constructed on mathematical formula, would the formula
change
> > > significantly if one compressed the width of the curve side to
> > side?
> > > If not, fine. If it does then it may make creation of a search
> > > formula less reliable.
> > > >
> > > > Does this make sense?
> > > >
> > > >
> > > >
> > > > It was just an off-hand thought that it might be nice to do a
> > Scan
> > > or Exploration for stocks which have price action which could
be
> > > construed to be forming a parabolic curve. This would be based
on
> > the
> > > lows of each bar following the exponential curve.
> > > >
> > > >
> > > >
> > > > Another issue if one were able to code this would be :
> > how "exact"
> > > would the fit have to be, or how much leeway or latitude would
> one
> > > accept in how perfect/imperfect the fit would have to be.
> > > >
> > > >
> > > >
> > > > I guess the problem is that to get the benefit of a short
term
> > > rally one needs to be able to identify the parabolic nature of
> the
> > > trend early enough to be able to take a position, before it
> becomes
> > > vertical. By definition then when the trend line becomes
vertical
> > > this signifies the end of the trend, and it's time to get out,
> > > because after that prices correct downwards rather quickly.
> > > >
> > > >
> > > >
> > > > There do seem to be a number of these patterns in the ASX
> market.
> > > >
> > > > I am not sure if this would be seen in other markets: human
> > nature
> > > being the same world wide, I would expect other markets to also
> > > exhibit this pattern.
> > > >
> > > >
> > > >
> > > > Here are some examples from today's market in Australia that
> fit
> > > the parabolic curve (see attached annotations)…
> > > >
> > > >
> > > >
> > > > http://www.members.iinet.net.au/~kris.mar/AWP.png
> > > >
> > > > http://www.members.iinet.net.au/~kris.mar/BBG.png
> > > >
> > > > http://www.members.iinet.net.au/~kris.mar/CDO.png
> > > >
> > > > http://www.members.iinet.net.au/~kris.mar/CEP.png
> > > >
> > > > http://www.members.iinet.net.au/~kris.mar/IFL.png
> > > >
> > > >
> > > >
> > > > I hope you can access these: if not I can email them to you.
> > > >
> > > >
> > > >
> > > > Regards
> > > >
> > > >
> > > >
> > > > Chrisb
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > DIMITRIS TSOKAKIS <TSOKAKIS@xxxx> wrote:chrisb,
> > > > Is it possible to describe, in words, what do you want to do ?
> > > > It is not hard to write parabolic lines in AFL but we need
some
> > > > additional info.
> > > > Example: There is only one straight line through two points,
> but
> > > > there are many circles/parabolas/ellipses. For these [2nd
> degree
> > > > lines] we need one more info [a third point, a radius, a
ratio,
> > > some
> > > > curvature etc.]
> > > > Dimitris
> > > > --- In amibroker@xxxxxxxxxxxxxxx, kris45mar <kris45mar@xxxx>
> > wrote:
> > > > >
> > > > > for anyone interested:
> > > > >
> > > > > Marcin tells me to just use the ARC drawing tool and this
> does
> > > > indeed work well with a bit of fiddling.
> > > > >
> > > > > Have a look see.
> > > > >
> > > > > Now, wouldn't it be nice to do a search based on this?
> > > > >
> > > > > chrisb
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > ---------------------------------
> > > > > Do you Yahoo!?
> > > > > Win 1 of 4,000 free domain names from Yahoo! Enter now.
> > > > >
> > > > > [Non-text portions of this message have been removed]
> > > >
> > > >
> > > >
> > > > Check AmiBroker web page at:
> > > > http://www.amibroker.com/
> > > >
> > > > Check group FAQ at:
> > > http://groups.yahoo.com/group/amibroker/files/groupfaq.html
> > > >
> > > >
> > > > Yahoo! Groups SponsorADVERTISEMENT
> > > >
> > > >
> > > > ---------------------------------
> > > > Yahoo! Groups Links
> > > >
> > > > To visit your group on the web, go to:
> > > > http://groups.yahoo.com/group/amibroker/
> > > >
> > > > To unsubscribe from this group, send an email to:
> > > > amibroker-unsubscribe@xxxxxxxxxxxxxxx
> > > >
> > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms
of
> > > Service.
> > > >
> > > >
> > > >
> > > >
> > > > ---------------------------------
> > > > Do you Yahoo!?
> > > > New and Improved Yahoo! Mail - 100MB free storage!
> > > >
> > > > [Non-text portions of this message have been removed]
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups SponsorADVERTISEMENT
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Express yourself with Y! Messenger! Free. Download now.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~->
Check AmiBroker web page at:
http://www.amibroker.com/
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|