Referring to DataSeries of an ActivePosition in Rotation Strategy
Author: Carova
Creation Date: 5/24/2017 3:36 PM
profile picture

Carova

#1
Hi!

I am trying to provide some diversification in a Rotation Strategy but my limited C# knowledge is showing.;)

I am looking to only add new positions which are poorly correlated to one another, however I am stumped at how to refer to the Series of an existing ActivePosition.
CODE:
Please log in to see this code.


rocSeries refers to the Series of a Symbol being pointed to by Set Context. Am I referring to the Series of an ActivePosition in the ROC.Series above correctly?

Thanks!
Vince


Edit: There appears to be no construct for Correlation.Value, only Correlation.Series. Is there any way to avoid the calculation of the whole correlation series?

V
profile picture

Cone

#2
QUOTE:
Am I referring to the Series of an ActivePosition in the ROC.Series above correctly?
Yes!

QUOTE:
There appears to be no construct for Correlation.Value, only Correlation.Series. Is there any way to avoid the calculation of the whole correlation series?
There's always a way, but there's no way to do it using the Correlation (or CorrelationXL) indicator. Let me see if I can find a reference to the source code and you can create your own function for this.
profile picture

Carova

#3
Thanks Cone!

BTW, is there any particular reason the the Value construct was not included for Correlation? It appears that would be a case when that construct would be particularly useful.

Vince

profile picture

Eugene

#4
Hi Vince,

QUOTE:
BTW, is there any particular reason the the Value construct was not included for Correlation?

No particular reason. If you wish to add it, you're welcome! The source code is open.
profile picture

Carova

#5
QUOTE:
No particular reason.


Hi Eugene!

I thought that the WL Team had tried to get the original submitters of the functions to provide complete rather than partial code before adding them to the libraries.

Vince
profile picture

Cone

#6
Why wasn't the Value method included? Maybe just lack of interest at the time.

This should work for you. It's the Correlation Series function adapted for ad-hoc values.

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

Carova

#7
Thanks Cone! MUCH appreciated!!


Vince


Edit: I figured it out.
profile picture

Eugene

#8
QUOTE:
How would I "wrap" this?

* Source code: Home - Community Indicators
* Reference: Wealth-Lab Version 6 (.NET) Development Guide > Create an Indicator Library
profile picture

Carova

#9
Thanks Cone and Eugene for all of your help!

Vince
profile picture

Eugene

#10
Vince, I'm going to include Cone's code in C.Indicators 2017.06.
profile picture

Carova

#11
QUOTE:
I'm going to include Cone's code in C.Indicators 2017.06.


Good to hear, Eugene.

Vince
profile picture

Eugene

#12
Vince, the change is checked in - you may update C.Indicators now.

P.S. The Correlation Wiki page has been updated.
profile picture

Carova

#13
Thanks Eugene!

Vince