[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: How to code a Adaptive StDev()



PureBytes Links

Trading Reference Links

Herman, Mike, all - just checking in and think I can offer a quick
suggestion and some code that I have handy.

1.  StDev() is a function that is not implemented as a variable period
function, but can be with a slight caveat.  Because this uses an
alternative, but algebraically equivalent formulation, that employs a
"data^2" term, it loses precision at about the 5th significant digit. 
That is close enough for most work, though.  So, anyway, this one liner
function will give a fast, variable period StDev ( IOW, vper can be a
varying array) -

function StDevVarPer( data, Vper )
{
return  sqrt( MA( data ^ 2, vper ) - MA( data, vper ) ^ 2 );
}

2.  This is fast even with large numbers of 1 minute bars, but it is
usually best to control QuickAFL with a statement like the following as
the LAST STATEMENT in the program to yield maximum performance -

SetBarsRequired( 500, 0 );

Remember that with QuickAFL in an indicator, the first execution after
an edit or insert passes the entire array to set the bar requirement,
then QuickAFL is in force on a subset.

-- BruceR





------------------------------------

**** 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/