I am trying to get ROC for ^GSPC but lets say for any stock from the first bar and I don't seem to be able to get it.
Trying to create series in rocGSPC
extGSPC is an external symbol
CODE:
Please log in to see this code.
Size:
Color:
This will be assigning a Series Bars.Count-212 times to RocGSPC. You forgot a [bar]:
CODE:
Please log in to see this code.
But being then partially correct from syntax standpoint, it's still a waste of resources. You should simply do this instead:
CODE:
Please log in to see this code.
Size:
Color:
Ok. but then when I want to plot it I cannot because it "does not exist in the current context" so how do I bring it into the main loop?
CODE:
Please log in to see this code.
Size:
Color:
You overlooked my comment and kept putting the code in the wrong place. My 2 lines were to replace your RocGSPC definition (i.e. the 2nd line of code that you've just commented out).
At the risk of repeating, defining a DataSeries in the loop is an unnecessary waste or resources - naturally, define any variable within a block of curly braces and it won't be accessible by the code below it.
Size:
Color:
At the risk of proving that I am retarded.
If i put the code where you are suggesting; outside the for loop then bar is undefined and I get an error. Bars.Count does not work either.
Size:
Color:
I made a copy/paste typo in my code while pasting from your code on the fly, this is why nothing will work. However, the nature of error made me have an extra look at your code, raising a series of questions:
1. Actually, not only were you "assigning a Series Bars.Count-212 times to RocGSPC". You were creating Bars.Count-212 * Series. Is this intentional? What is the point?
2. Could you explain what "ROC for any stock from the first bar" you think is? Because any DataSeries starts from the first bar, by design.
3. What is "accumdays", should it be based on ^GSPC or the current Bars as it is currently?
I want to have a clear picture of what you were trying to accomplish with that code, before giving out any fix.
Size:
Color:
I am asking a retarded question. I just figured out in trying to explain to you what I am looking for what I am looking for.
Thanks.
Size:
Color:
A wise man's question contains half the answer :)
Size:
Color: