New version 17 available now


Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

MAXH and MINL within a past range Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Jason
Posted : Tuesday, September 26, 2017 10:56:24 AM
Gold Customer Gold Customer

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

Bruce_L
Posted : Tuesday, September 26, 2017 11:17:53 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,183

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
Jason
Posted : Tuesday, September 26, 2017 11:41:10 AM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 17

Got it. Thanks. 

Jason
Posted : Sunday, October 08, 2017 6:13:35 PM
Gold Customer Gold Customer

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?

Jason
Posted : Sunday, October 08, 2017 6:42:38 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 17

What about this....

If C on Dec 30 is > C on Jan 4 then (your formula from above) 

Bruce_L
Posted : Monday, October 09, 2017 9:52:56 AM


Worden Trainer

Joined: 10/7/2004
Posts: 61,183

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
Jason
Posted : Tuesday, October 10, 2017 1:11:24 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 17

Got it. Thanks. 

Bruce_L
Posted : Tuesday, October 10, 2017 1:13:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 61,183

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.