Reset a DataSeries to zero and restart count
Author: gbullr
Creation Date: 4/14/2011 4:05 PM
profile picture

gbullr

#1
You had helped me w/ this before, but I cannot find the thread.

So here is the problem. I need to find a way to reset a Sum series to zero. I have written this code but it just sets that day to zero rather than the whole series to zero.

CODE:
Please log in to see this code.


So if the S&P is up more than x pct (in this case 1.5 pct ) I want the thing to reset to zero and start the prior count again.

Thanks in advance for your help. Regards.

profile picture

Eugene

#2
It's not clear what you're doing. Please rephrase why would you want to clear the whole DataSeries.
profile picture

gbullr

#3
I don't want to clear it . I want to set it to zero and start re counting distridays.

Conceptually I want to count within 15 days periods days in which the S&P is down on higher volume. If the market goes up by 1.5 % then I want to reset the count to zero and then start re counting days in which the S&P is down on higher volume.

Thanks.

profile picture

Eugene

#4
For me, your code is doing just it: restarts the count next day after dropping it to zero.
profile picture

gbullr

#5
I don't think so. It takes it to zero, but the next time there is a down day it takes the count of down days from the previous 15 days not starting at the last up 1.5% day.

Is that more clear?

Thanks.

profile picture

gbullr

#6
Where do we make suggestions for the program.

I would like to suggest that the program allow for a Chart and strategy to be open on different screens so that people that have more than one monitor can have a chart and a strategy open in different screens which would allow for significantly higher efficiency than toggling from Editor to Chart.

Thanks.
profile picture

Cone

#7
Fidelity customers should call and talk to the Wealth-Lab / Active Trader phone reps to request features.

Anyway, even though it's off the topic of your own thread, I don't understand the problem. If you change code in the Editor, then click "Run the Strategy", the strategy is compiled, executed, and automatically displays the chart view. If the idea is to divorce the Editor and the Chart from being in the same child window, then that's a major design change that will never happen. If that's not the idea, then please be more specific.

QUOTE:
Is that more clear?
Not for me!
profile picture

gbullr

#8
There is no "problem." it would be a lot more efficient if one could have the editor open on one screen and a chart w/ the strategy open on another screen and when one compiles, the screen w/ the chart updates automatically. As it is now. One has to toggle from the editor to see what has happened in the chart. You can't just look over at your second screen and see what happened.

How do I get back to discussing my original thread?

profile picture

Cone

#9
QUOTE:
One has to toggle from the editor to see what has happened in the chart
If you click "Run the Strategy", it compiles, runs, and displays the chart in one click. It's pretty efficient.

QUOTE:
How do I get back to discussing my original thread?
Just start?
profile picture

gbullr

#10
It is not that efficient if you have two screens. A lot less efficient than changing your gaze.


So back to the original question.

If you look at the following code you will see that although distridays is sometimes set to zero, on the following bar, it immediately reverts to the prior count. I would like it start counting from zero as if the new data series is started when the S&P is up 1.5 pct. Thanks. So I guess the question is do I create the dataseries in the second for int loop? I think that messes things up.

Thanks for your help.



CODE:
Please log in to see this code.

profile picture

Cone

#11
QUOTE:
It is not that efficient if you have two screens. A lot less efficient than changing your gaze.
I'm not letting you get off that easily. If you have to click the button to "Run the Strategy" to compile and run, and then the same window changes to the chart, there is no "change in the gaze". You'd have to change to look at another screen.

That said, I understand you prefer it your way, but there's really no way it will ever happen. Sorry, but don't shoot the messenger.


As for the code, I'm trying to read between the lines. Does this do it?

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