Reintializing a dataseries
Author: thetraderman
Creation Date: 4/26/2011 9:34 AM
profile picture

thetraderman

#1
Is there a shortcut method I can use to reset a dataseries back to zero after it's created and used. I would like to do this in between bar updates.
profile picture

thetraderman

#2
In the course of thinking about it, this is what I came up with. Does this seem appropriate? I guess other members would be interested as well.

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

Eugene

#3
Yes this should work. Among the other options are assigning something like Close-Close to your AnotherSeries, or assigning zero to each bar of the DataSeries in a loop.
profile picture

Cone

#4
It's not ideal and will only work once. When you assign AnotherSeries to ZeroFilled, they point to the same series reference -

CODE:
Please log in to see this code.
If you want a fresh series, just use the "new" operator again.
profile picture

thetraderman

#5
Wow, thanks. I was seeing some strange behavior and did not understand why. Probably because of this. I guess in the future I should write a little program and test it first before just assuming it will work.
profile picture

Eugene

#6
Hint: you might want to use LINQPad to test code snippets.
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).