Power function. How to use DataSeries as the exponent?
Author: mikesblack
Creation Date: 1/1/2010 9:36 PM
profile picture

mikesblack

#1
CODE:
Please log in to see this code.



Happy New Years fellas. Wish you good health and happiness for the coming year!!

Can you help me with this? Thanks.

Want to use nested DataSeries values for the exponent variable. In this case it's dataseries asq raised to the DataSeries.Abs(aspread))as shown.

Is there a way to do this?


http://www2.wealth-lab.com/WL5Wiki/Power.ashx
From Community. Indicators.
Power
"Syntax


DataSeries Power(DataSeries ds, double y)


Edit
Parameter Description
ds Specify data series
y Specify power

Edit
Description
Returns a specified data series raised to the specified power."
profile picture

Eugene

#2
I guess it goes something like (in pseudocode; untested):

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

mikesblack

#3
CODE:
Please log in to see this code.



I'm not comprehending this yet. Why can we not use a dataseries as a variable for the exponent, but can so for the base, and what are you doing in this script that bypasses this restriction? Can you clarify syntax and expand this for me? When you write for (int bar...) loop
{
pwr[bar] = Power(ds,y[bar]); What is ...?
profile picture

Eugene

#4
Sorry for a typo. It's a series, so the usual syntax applies:
CODE:
Please log in to see this code.
profile picture

Cone

#5
mikes, you can call the Community.Indicators method for a 1 liner that returns a DataSeries, or do it all yourself using the static method in Math called Pow. Since you're using a variable, y[bar], as one of the indicator parameters, you should not use the Indicator method since that would result in creating and caching up to a Bars.Count number of series - a different series for each value of the DataSeries y.

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

mikesblack

#6
CODE:
Please log in to see this code.


I'm getting a syntax error after loop. It wants a (;) ; however that does not work.
profile picture

mikesblack

#7
Ok.. I got it. Thanks very much!!
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).