Skewness method
Author: Christos
Creation Date: 8/29/2011 11:09 AM
profile picture

Christos

#1
I have written a method for skewness but I it performs much slower than I expected. If I run the below script on more than 1000 bars it is really slow and sometimes the program gives an out of memory exception (>1500).

Could you suggest any way to optimize performance?

CODE:
Please log in to see this code.
profile picture

Cone

#2
Don't use DataSeries when you only need to find 1 value. Specifically, you've done this 2 or 3 times:

CODE:
Please log in to see this code.

Every time you change the value for AvgRet on a bar, an entire new series for Num is created... but you only need one value!
profile picture

Eugene

#3
No wonder you've got OOM exceptions -- this code create tons of DataSeries on each bar:
CODE:
Please log in to see this code.

Why not adopt gbeltrame's WL4 Skewness code? Its output seems reasonable:
CODE:
Please log in to see this code.
profile picture

Christos

#4
Thanks to both of you for your help. I had focused on obtaining the correct result for a small sample of data and paid no attention to that issue.

Eugene,
Both for reasons of practicing and because the code seemed to me somewhat complicated for the simple problem of skewness and kurtosis I decided to rewrite the two methods which now work fine (I think :) ). Is it possible to include them in the next update of Community Indicators please?


CODE:
Please log in to see this code.
profile picture

Eugene

#5
QUOTE:
Is it possible to include them in the next update of Community Indicators please?

When managing over 20 solutions, "in a future update" would be a more safe term but since my renditions of gbeltrame's Skewness/Kurtosis functions were already checked in earlier today, then sure, they're coming in the next update.
profile picture

Eugene

#6
Added Skewness and Kurtosis to Community Indicators v.2011.09.
profile picture

Christos

#7
Thanks Eugene