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

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



PureBytes Links

Trading Reference Links

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


Tomasz, from your perspective all problems are simply a matter of "looking it up", but with all due respect, this is not always the case. There is no algebra book that helps in creating an adaptive BB. Collectively we probably spend over 100 hours trying to solve this problem - and some of us have obviously excellent math skills. 


Please see the formula below that we came up with, it works nice BUT under certain circumstances causes errors. Which one of 'every algebra book' will explain how to fix this?


btw, an adaptive BB (or StDev()), would be a nice addition the afl ;-) especially to RT Intraday traders.


Thanks,

herman


// Adaptive BB


P = ParamField( "Price field", -1 );

Periods = Param( "Periods", 15, 2, 100, 1 );

Width = Param( "Width", 2, 0, 10, 0.05 );


MAC = MA( p, periods );

Dev = Width * sqrt( MA( p * p, periods ) - MAC * MAC );

BBBot = MAC - Dev;

BBTop = MAC + Dev;


Plot( C, "", 1, 128 );

Plot( BBTop, "", 5, 1 );

Plot( BBBot, "", 5, 1 );





Sunday, June 14, 2009, 6:29:40 PM, you wrote:


> This formulation is in every algebra book and used in school often

> because it is quicker even for human to calculate that way.


> Best regards,

> Tomasz Janeczko

> amibroker.com

> ----- Original Message ----- 

> From: "brian_z111" <brian_z111@xxxxxxxxx>

> To: <amibroker@xxxxxxxxxxxxxxx>

> Sent: Monday, June 15, 2009 12:06 AM

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



>> Nice work Bruce.


>> I was trying to make up my own algebraic equivalent in lieu of a reference source, or sources.



>> Did you get 'your' version of StDev from a reference of is it your own work?


>> --- In amibroker@xxxxxxxxxxxxxxx, "bruce1r" <brucer@xxx> wrote:


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






> ------------------------------------


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





__._,_.___


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





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___