At the risk of throwing more gasoline on this fire, I thought I would expand on 
my post #148811, which outlined a method for plotting a line segment on an 
existing price plot.

I compute 2 different regression fits to a QUADRATIC equation by method of 
Gaussian Elimination.
I plot a 2 segments of the resulting parabolas (shorter and longer) on  the 
price bar chart using the method in post #148811.
I can slide the 2 segments back and forth along the time axis using a LookBack 
variable in the Parameters window.
I can expand or contract the time axis (+ / - Zoom) and the display stays 
correct.
I have been using this method since late 2004 - 5-6 years. Many different 
versions of AmiBroker.  Hasn't broken yet.

I create a ranking indicator from the QuadFits for about 800 ETF's that I track.

Will probably add to the confusion:

ReefBreak




--- In [email protected], Tomasz Janeczko <gro...@...> wrote:
>
> Hello,
> 
> It was explained many times on the list and it is documented in
> http://www.amibroker.com/kb/2008/07/03/quickafl/
> (take a close look at the picture)
> 
> that BarCount IS DYNAMIC, DEPENDENT on ZOOM.
> 
> The code here:
> 
> Plot( IIf( BarIndex()>= BarCount - EMABarsVisible21, EMA( C,21), Null ), "", 
> colorViolet,styleNoLabel |5 );
> 
> is totally WRONG.
> 
> because it assumes that BarCount has any relationship with BarIndex().
> IT DOES NOT!
> 
> The code will work only if ALL bars existing are in fact used by the 
> formula.
> It is NOT the case in majority of cases.
> 
> Only when you request all bars, or if you zoom out completely or if you 
> press "refresh all" for the very first
> time it will use all bars.
> Otherwise the formula use LESS BARS than all and quoted formula is 
> INCORRECT for all those cases.
> 
> Again, reading it:
> http://www.amibroker.com/kb/2008/07/03/quickafl/
> is necessary.
> 
> Short advice:
> DO NOT use BarCount for ANYTHING else than building a for loop that 
> iterates through array elements like
> this:
> for( i = 0 ; i < BarCount; i++ )
> {
>    array[ i ] = H[ i ] + L[ i ];
> }
> 
> This is one and the only one use of BarCount (at least for people 
> without proper understanding of what was described in the
> article pointed out above).
> 
> 
> Best regards,
> Tomasz Janeczko
> amibroker.com
> 
> On 2010-04-24 10:25, progster01 wrote:
> > The working two-liner is great, and very clear to understand as given:
> >
> > bi = BarIndex();
> > Plot( IIf( bi<  LastValue( bi ) - 21, Null, EMA( C, 21 ) ), "EMA", colorRed 
> > );
> >
> > But why doesn't this other code that was discussed:
> >
> > Plot( IIf( BarIndex()>= BarCount - EMABarsVisible21, EMA( C,21), Null ), 
> > "", colorViolet,styleNoLabel |5 );
> >
> > successfully accomplish the same thing?
> >
> > Understanding the difference, exactly, is much to be desired, IMO.  Knowing 
> > the platform deeply enough to understand and avoid such pitfalls is the 
> > goal of many of us.
> >
> > I ask here on the list so that all may benefit from any answer that might 
> > be provided.
> >
> >
> > --- In [email protected], Tomasz Janeczko<groups@>  wrote:
> >
> >    
> >> Original question was:
> >>   >  How to plot 21 days EMA only for the last 21 bars.
> >>
> >> And the answer is TWO liner:
> >>
> >> |bi = BarIndex();
> >> Plot( IIf( bi<  LastValue( bi ) - 21, *Null*, EMA( *C*, 21 ) ), "EMA",
> >> *colorRed* );|
> >>
> >> And it works in ALL AmiBroker versions.
> >>      
> >
> >
> >
> > ------------------------------------
> >
> > **** IMPORTANT PLEASE READ ****
> > This group is for the discussion between users only.
> > This is *NOT* technical support channel.
> >
> > TO GET TECHNICAL SUPPORT send an e-mail directly to
> > SUPPORT {at} amibroker.com
> >
> > TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
> > http://www.amibroker.com/feedback/
> > (submissions sent via other channels won't be considered)
> >
> > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
> > http://www.amibroker.com/devlog/
> >
> > Yahoo! Groups Links
> >
> >
> >
> >
> >
>


Reply via email to