Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 17
|
Hi. Is it possible to calculate the percentage gain of stocks during a distant time? For example, what was the gain (MINL to MAXH) during 2016 (or during any period in the past)?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It is possible, but the formulas can be a bit complicated to figure out.
If you were just interested in the price percent change for 2016, you could do this just knowing the last trading day of 2015 and 2016.
100 * (C'12/30/2016' / C'12/31/2015' - 1)
But if you want to know the how far the high was above the low as a percentage, you would need to know the last trading day of 2016 and the number of trading days in 2016 (which by my count is 252 trading days).
100 * (MAXH252.'12/30/2016' / MINL252.'12/30/2016' - 1)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 17
|
Got it. Thanks.
|
|
Registered User Joined: 10/7/2004 Posts: 17
|
The formula you offered works for both percentage gains and losses (not just gains). Is there a way to put a second criteria in such that the date of the MAXH had to be later than the date of the MAXL?
|
|
Registered User Joined: 10/7/2004 Posts: 17
|
What about this....
If C on Dec 30 is > C on Jan 4 then (your formula from above)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You would really want to use TC2000 v17 instead of TC2000 v7 for this sort of thing as the Personal Criteria Formula Language has been extended significantly.
Not that it can't be theoretically done in TC2000 v7 if you get out a calendar and hand enter all of the dates into formulas constructed using the techniques in the Min Max PCFs topic (but you would have to extend the technique as well as it only has templates out to 32 bars), but there really isn't a reasonable way to find out if MAXH or MINL happened first in a date based formula covering the span of an entire year.
100 * ABS(C'12/30/2016' > C'01/04/2016') * (MAXH252.'12/30/2016' / MINL252.'12/30/2016' - 1)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 17
|
Got it. Thanks.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |