Creating an average of the last 100 values of ATRP
Author: MikeyRules
Creation Date: 4/16/2010 11:58 AM
profile picture

MikeyRules

#1
Hello,

I would like to calculate the average of the last 100 values of the ATRP indicator and keep that value in a dataseries. I have looked through the Wiki, the various guides and the forum but haven't been able to locate a way of doing this. Can anyone point me to an example of something similar? Thanks in advance
profile picture

Eugene

#2
Something like this?
CODE:
Please log in to see this code.
profile picture

Cone

#3
Eugene, why not with SMA.Series?

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

Eugene

#4
The more ways to skin a cat, the better :) In the first approach, you can also eliminate repeating values of the ATRP, making an average of the unique values.
profile picture

MikeyRules

#5
That looks like it should do it, thanks! Am testing now. Quick question, why did you multiply artp.FirstValidValue by 3? Let me know, thanks.
profile picture

MikeyRules

#6
I do want all values, not just unique ones, so should I use Cone's for that?
profile picture

Eugene

#7
1 - See Indicators > Stability of Indicators in the WealthScript Programming Guide.
2 - Anything goes (not implemented).
profile picture

MikeyRules

#8
Got it, thanks!! I appreciate the 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).