PureBytes Links
Trading Reference Links
|
> SetBarsRequired( 500, 0 );
I have noticed that while the manual indicates that SBR is a legacy function (left over from scripting days?) a lot of people still use it ... now I see why.
Thanks to all ... discussion on custom coding of Median()/adpativeStDev was a very good AFL study piece for me and I don't find that we lose anything when the discussion moves from topic to topic or even jumps around within the topic.
Top marks to bruceR who followed every nuance of the discussion across two or three rambling topics and guided us to a home run.
--- In amibroker@xxxxxxxxxxxxxxx, "bruce1r" <brucer@xxx> wrote:
>
> Herman -
>
> The discontinuities are straightforward to fix. They are caused by very
> small numbers in the "dev" result. Simply apply Nz() to it. I've left
> the debug approach in the code below.
>
> Now, I'm just trying to help, but I don't know if you are going to see
> the effect that I'm referring to until you place the following statement
> at the END OF THE CODE -
>
>
> I'm taking some liberties with Tomasz's way of explaining this, but
> another way to think of this is that it is limiting ALL internal
> calculations in the AFL to 500 bars before the first visible bar PLUS
> just visible bars. The reason that this is so important is that it
> streamlines all calculations by limiting their bar scope.
>
> I've left it in the code below and suggest that you run the following
> experiment -
>
> 1. Bring the code below up in an editor.
> 2. Insert it into a chart and note the timings.
> 3. NOTICE THAT THE BARCOUNT ON THE SECOND LINE IS ALL BARS. This
> isbecause the first execution of an AFL after an edit or insert
> mustassume all bars for QuickAFL to calculate its requirements.
> 4. NOTE THE LAST LINE OF THE CODE - SetBarsRequired(500, 0).
> Whatthat is doing is to override AFL and tell it to process only 500
> barsbefore the first visible bar and no future bars.
>
> 5. Now, click anywhere on the chart and note how the barcount on
> thesecond title line changes. QuickAFL is now processing a subset
> ofbars. It should be bars visible + 500.
> 6. MOST IMPORTANTLY, look at the timings in the first line and how
> they change.
> In probably 99 out of 100 cases, an all array implementation
> withQuickAFL utilized will outperform a looping implementation, usually
> byfar.
>
> -- BruceR
>
>
> Periods = Param("Periods", 15, 4, 50, 1 );
> Width = Param("Width", 2, 0, 10, 0.05 );
>
> function BB2()
> {
> global periods, width, dev;
> global temp;
>
> MAC = MA( C, periods );
> Dev = Width * sqrt( MA( C*C, periods ) - MAC*MAC );
> temp = dev;
> dev = Nz(dev);
> BBTop = MAC + Dev;
> BBBot = MAC - Dev;
> Plot(BBTop, "", colorRed);
> Plot(BBBot, "", colorRed);
> }
>
> LOOP = 10;
>
> GetPerformanceCounter( True );
> for ( i = 0; i < LOOP; i++ )
> bb2dev = BB2();
> BB2avg = GetPerformanceCounter( ) / LOOP;
>
> Plot( C, "", colorDefault );
> Plot( MA( C, periods ), "", colorGreen );
>
> Title = StrFormat( "BB2 avg elapsed = %6.3f", bb2avg );
>
> barsvis = LastValue( Cum( Status( "barvisible" ) ) );
> Title = Title + StrFormat( "\nBarcount = %5.0f, bars visible
> = %5.0f", BarCount, barsvis );
>
> Title = Title + "\nIsNull(temp) = " + IsNull(temp);
>
> SetBarsRequired( 500, 0 );
>
------------------------------------
**** 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
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> 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/
|