Chartscript Return Calculation
Author: msyl
Creation Date: 10/15/2008 9:23 AM
profile picture

msyl

#1
I would like to help me in the calculation of return series in a chartscript. I tried the following but i have a signal: Not a method!
SPXRET := ( SPX( Bar, #Close ) - SPX( Bar - 1, #Close ) ) / SPX( Bar - 1, #Close ) + 1;

Any idea?
profile picture

Eugene

#2
Manolis,

Note that you were posting your question -

1) in three topics at the same time (known as crossposting),
2) in others' threads (dedicated to their particular problems which does not apply to your question in any way - known as offtopic),
3) in .NET topics (despite the code snippet looks like WL4 and there's a mention of the word chartscript).

What's SPX? What is "return"?
profile picture

Cone

#3
Well, here's the code for the two versions. You'll see that Version 5 is a little bit friendlier when it comes to series math -

Version 5 (Execute method code)
CODE:
Please log in to see this code.


Version 4
CODE:
Please log in to see this code.