Title: How to code a Adaptive StDev()
Would anyone have coded an adaptive StDev? I am using the solution below but is is VERY slow and the number of max period value is limited.
My math is just not up to this and any help would be very much appreciated!
have a great day,
Herman
function xStDev( priceArray, Periods) // Periods < 25
{
global BBTop, BBBot;
Periods = Min( 25, periods );
Periods = Max( 2, Periods);
Deviation =
IIf( Periods == 2, StDev( PriceArray, 2 ),
IIf( Periods == 3, StDev( PriceArray, 3 ),
IIf( Periods == 4, StDev( PriceArray, 4 ),
IIf( Periods == 5, StDev( PriceArray, 5 ),
IIf( Periods == 6, StDev( PriceArray, 6 ),
IIf( Periods == 7, StDev( PriceArray, 7 ),
IIf( Periods == 8, StDev( PriceArray, 8 ),
IIf( Periods == 9, StDev( PriceArray, 9 ),
IIf( Periods == 10, StDev( PriceArray, 10 ),
IIf( Periods == 11, StDev( PriceArray, 11 ),
IIf( Periods == 12, StDev( PriceArray, 12 ),
IIf( Periods == 13, StDev( PriceArray, 13 ),
IIf( Periods == 14, StDev( PriceArray, 14 ),
IIf( Periods == 15, StDev( PriceArray, 15 ),
IIf( Periods == 16, StDev( PriceArray, 16 ),
IIf( Periods == 17, StDev( PriceArray, 17 ),
IIf( Periods == 18, StDev( PriceArray, 18 ),
IIf( Periods == 19, StDev( PriceArray, 19 ),
IIf( Periods == 20, StDev( PriceArray, 20 ),
IIf( Periods == 21, StDev( PriceArray, 21 ),
IIf( Periods == 22, StDev( PriceArray, 22 ),
IIf( Periods == 23, StDev( PriceArray, 23 ),
IIf( Periods == 24, StDev( PriceArray, 24 ),
StDev( PriceArray, 25 ))))))))))))))))))))))));
return Deviation;
}
__._,_.___
**** 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/
__,_._,___
|