Suppose that I wanted to store the S&P return for the prior calendar year in a variable, how would I do this.
Lets say that I want to tell a system that if the market was up more than 50 pct the prior calendar year to not buy for a year.
Storing that under non calendar basis is easy and it would be something like ROC.Series(external.Close,252);
but how do I do it on a rolling calendar year basis.
Thanks.
Size:
Color:
A new year starts when:
CODE:
Please log in to see this code.
At this bar, you store the current bar in an integer variable e.g. cBar. The difference between the bar and this variable at this bar is the number of the previous year's trading sessions. So, on the first day of a year this should give you the previous year's return:
CODE:
Please log in to see this code.
Or it can be estimated by replacing "bar-cBar" with "252" for simplicity. Save that value in a double variable and reuse it.
Size:
Color:
Thanks a lot Eugene.
Size:
Color:
Or simply pass your
external.Close to this already available indicator:
Year To Date Gain.
Size:
Color:
Hi.
Can you point me to the area where I can find the attributes for Date and DateTime.
I am trying to figure out how to play around w time of day, but also month and year.
Thanks a lot.
Size:
Color:
In
MSDN, on
Dotnetperls, and in thousands of other sites promoting C# found by Google.
Size:
Color:
Thanks.
Size:
Color: