Cumulative indicator
Author: grtrader
Creation Date: 11/20/2018 12:39 PM
profile picture

grtrader

#1
Is there an indicator to plot the cumulative values of a series? I found SUM, but that only sums a fixed number of previous values. If not, how would this be done?
profile picture

Eugene

#2
Here's how:
CODE:
Please log in to see this code.
profile picture

superticker

#3
It would save some time if the code
CODE:
Please log in to see this code.
... was written as
CODE:
Please log in to see this code.
The first approach should still work because ci[bar] will always initially be zero, but you're doing an extra add operation by adding to zero. The line below may also work (saving some processor register manipulations), but you'll have to try it to be sure.
CODE:
Please log in to see this code.
profile picture

Eugene

#4
Thanks. Actually I made a typo, the "+" in the ci[bar] assignment is superfluous.
profile picture

grtrader

#5
Thanks for the coding! Learn something new everyday.
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).