Advance Decline Line
Author: gbullr
Creation Date: 3/31/2014 12:55 AM
profile picture

gbullr

#1
Help please and thank you in advance

I am obviously doing something wrong because it compiles but then there appears to be no A/D Line

I am trying to calculate the advance decline line for the last 60 days

Even interchanging lines 49 and 50 it does not work.

CODE:
Please log in to see this code.


I am sure there is an easier way to do this but I am c# impaired.

Thanks for your help.
profile picture

Eugene

#2
No need to code Advance/Decline Line because it's a built-in IndexDefinition. To create one, open up Index-Lab from the Tools menu. For more information, refer to the synonymous topic in the Wealth-Lab User Guide.

P.S. Wealth-Lab comes with a number of preset market breadth indicators. If you want several dozens more, install the MS123 IndexDefinitions library. Here's a description of what's included: MS123 IndexDefinitions - Component list.
profile picture

Cone

#3
First pointer -
CODE:
Please log in to see this code.
i.e., don't perform the calculation of a DataSeries inside of a loop. The result of the calculation of Sum.Series, a DataSeries, is needlessly assigned over and over to advn_decA. (Internally Wealth-Lab saves you from this because just caches the first result, so it is not recalculated each time; but it's just bad style.)

Second pointer -
QUOTE:
DataSeries advn_decA = new DataSeries(Bars,"advn_decA"); // I finally understood the point of this!!
You do not need to initialize a "new" DataSeries this way unless you plan to calculate the value for each bar yourself.

Third pointer (and this is the real problem) -
CODE:
Please log in to see this code.


Of course, there's no reason to create a 1-bar moving average, so all this code reduces to:
CODE:
Please log in to see this code.

profile picture

Cone

#4
Eugene, the symbols involved are Fidelity Market Sentiment that provides the Advancers and Decliners for all issues on the exchange. We can't recreate that in Index-Lab, especially since the number of symbols traded are always changing.
profile picture

Eugene

#5
Robert, you're right. I just thought that as topic starter asks for "Advance Decline Line", he might want neither the code-based solution nor the two groups of market breadth symbols in his script (from both Fidelity and Market Sentiment provider).
profile picture

gbullr

#6
Gentlemen:

Thank you. I know the questions may seem perfunctory to you, but I appreciate your help.

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).