Standard Deviation of Variable
Author: tradertabb
Creation Date: 7/13/2012 5:25 PM
profile picture

tradertabb

#1
Trying to create a standard deviation of a variable I've created (double) for the past 20 values?

I tried this:
CODE:
Please log in to see this code.

profile picture

Eugene

#2
At any rate, the first argument of StdDev.Series should be a DataSeries. C-C[1] looks like a double value. How about this?
CODE:
Please log in to see this code.
profile picture

tradertabb

#3
Like this you mean?

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

Eugene

#4
Right.
profile picture

tradertabb

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


I get the error code that says : ... finantic , this is a method not valid in the given context.

Again, I am trying to compute a standard deviation of the last 10 changes (C-C[1]).
profile picture

Eugene

#6
Ideally, you should have mentioned that a ChartScript-to-Strategy transition is taking place. You know that this is an entirely different problem because I personally explained it to you in a previous thread.

Normal solutions do not apply here, and playing with WSTL output is almost always doomed to fail. The Translator's syntax overrides Wealth-Lab's types e.g. ChartPane with its own. Mixing WSTL (your snippet) and standard (my suggestion above) syntaxes will create confusion. You can go two ways here: get rid of WSTL's contructs, basically coding the Strategy from scratch in C#, or find out yourself how to fix it.

As my memories of WSTL are scattered, AFAIR you should define an integer varible first and then populate the series. Something like this:
CODE:
Please log in to see this code.

If my code won't instantly compile, I highly suggest you visit the old KB section on legacy WealthScript syntax.
profile picture

tradertabb

#7
Thank you for your help Eugene - I appreciate it.

Also, who could I hire to help rewrite the script for me properly in C#? I've asked this before, but as I recall there was a "we will have this available soon" answer. Could I reach out to one of the community members here?
profile picture

Eugene

#8
Sorry but that MarketPlace feature was dwindled from our priority list in favor of a different project. I could rename this topic for you to help the aspiring fellow coders find it?
profile picture

tradertabb

#9
Thank you, that would be great.
profile picture

tradertabb

#10
Eugene, I think I am still not explaining what I need the right way:

This variable: Pchange, is representing the total change in value to the portfolio on that day

Pchange = change today (close - close[1]) * weighted value of the current position (we use multiple positions)

We want to measure the Standard Deviation of Pchange (portfolio change by this position) above.

Each time we try to compute the Std Dev it requires a price series, but doesn't seem to allow us to do a Std Dev on this variable we created (Pchange).

Does this make any sense?
profile picture

Eugene

#11
You probably should have mentioned this "little" detail right from the start. ;) As it changes things dramatically.

I do not think that you will be able to factor in a "portfolio change value" into a WSTL translated script. Wealth-Lab 5/6 does not support access to a portfolio's equity curve from within a Strategy.

As far as a pure WealthScript solution is considered, it's possible with a workaround: example of a technique. For more details, please search the forums.
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).