Quiet accumulation: improve code
Author: MrHari
Creation Date: 8/19/2017 7:01 PM
profile picture

MrHari

#1
I have following code:

CODE:
Please log in to see this code.


This code looks too verbose. Is this the right way to write code using WealthScript? May be there is already an indicator or library util to do this. Is there any suggestion to improve this?

The annotations will show only on few charts. It shows up on BABA weekly, CBOE weekly, etc.
profile picture

Eugene

#2
Note that "pctChange" is in fact ROC - a built-in indicator.

There are many ways to skin a cat. Here's an alternative that uses SeriesIsAboveValue and its counterpart SeriesIsBelowValue from Community Indicators.

These indicators can be used to count the number of bars a series like ROC has stayed above/below a value for N bars. The extra ChartPanes visualize the ROC values - hope this should answer why it shows on some charts and not the other.

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

MrHari

#3
Thanks Eugene!
profile picture

Eugene

#4
You're welcome. Note that the last argument (the "5") could be made a parameter i.e. N-week accumulation.

CODE:
Please log in to see this code.
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).