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


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Profile: alatar
About
User Name: alatar
Groups: Beta Testers, Gold User, Member, TeleChart
Rank: Registered User
Real Name: Ken Powers
Location Suwanee, GA
Occupation:
Interests:
Gender: Male
Statistics
Joined: Thursday, October 7, 2004
Last Visit: Friday, September 1, 2006 9:33:03 PM
Number of Posts: 4
[0.00% of all post / 0.00 posts per day]
Avatar
Last 10 Posts
Topic: Trading for a living.
Posted: Monday, December 20, 2004 10:32:00 AM
I apologize for going off topic, BUT why is this thread a "sticky"?
Topic: Days Since Last Peak
Posted: Monday, December 13, 2004 1:24:54 AM
The formula you're using returns the value I would expect. When I look at CHRW's daily chart, the MAX low over the last 25 trading days was 24 trading days ago at $54.44 on November 5th. Incidentally, the MAX high over the last 25 trading days was also 24 trading days ago at $55.37 on November 5th.

I suspect that what you were actually looking for was the MIN low over the last 25 trading days, which was 17 trading days ago at $51.25 on November 16th. Incidentally, the MIN high over the last 25 trading days was 17 trading days ago at $52.11 on November 16th.

Now, here's the puzzling thing. Jim Dean created a separate thread (which has since disappeared) in which he replicated this topic and to which I replied in greater detail (with the general formulas for determining both the highest value and the lowest value over any number of bars). It probably would have been helpful. Let me see if I can recreate it.

The general formula for determining the highest value (the High in this case) over the last [n] bars is:

[n]
+ [n]*(H0=maxH[n])
- [n-1]*(H1=maxH[n])*(H1>H0)
- [n-2]*(H2=maxH[n])*(H2>maxH2)
- ...
- 1*(H[n-1]=maxH[n])*(H[n-1]>maxH[n-1])

The general formula for determining the lowest value (the Low in this case) over the last [n] bars is:

[n]
+ [n]*(L0=minL[n])
- [n-1]*(L1=minL[n])*(L1<L0)
- [n-2]*(L2=minL[n])*(L2<minL2)
- ...
- 1*(L[n-1]=minL[n])*(L[n-1]<minL[n-1])

You can expand either formula to as many terms as you like, but I have found that my computer begins to slow when it exceeds 100 bars. Of course, that is dependent on how fast your processor is, how much RAM you have and how many other PCFs you have. And, if I put too many in custom indicators (to avoid long PCF calc times), I can slow my computer to a virtual crawl. So, forewarned is forearmed. Happy computing and good trading/investing!
Topic: Days Since Last Peak (or other day-counting needs)
Posted: Thursday, December 9, 2004 10:30:14 PM
As I noted in the original thread:

Jim Dean's logic is, as always, beautiful and irrefutable. But you can improve processing speed by reducing the number of nested parentheses with the following formula to determine the number of days since the high was observed.

5
+ 5*(H0=maxH5)
- 4*(H1=maxH5)*(H1>H0)
- 3*(H2=maxH5)*(H2>maxH2)
- 2*(H3=maxH5)*(H3>maxH3)
- 1*(H4=maxH5)*(H4>maxH4)

In addition to my original post, I would offer the following as the general formula for counting the number of bars since the highest value was observed over the last [n] bars:

[n]
+ [n]*(H0=maxH[n])
- [n-1]*(H1=maxH[n])*(H1>H0)
- [n-2]*(H2=maxH[n])*(H2>maxH2)
- ...
- 1*(H[n-1]=maxH[n])*(H[n-1]>maxH[n-1])

Likewise, following is the general formula for counting the number of bars since the lowest value was observed over the last [n] bars:

[n]
+ [n]*(L0=maxL[n])
- [n-1]*(L1=minL[n])*(L1<L0)
- [n-2]*(L2=minL[n])*(L2<minL2)
- ...
- 1*(L[n-1]=minL[n])*(L[n-1]<minL[n-1])

Ken Powers
aka "alatar"
Topic: Days Since Last Peak
Posted: Thursday, December 9, 2004 9:48:46 PM
Jim Dean's logic is, as always, beautiful and irrefutable. But you can improve processing speed by reducing the number of nested parentheses with the following formula to determine the number of days since the high was observed.

5
+ 5*(H0=maxH5)
- 4*(H1=maxH5)*(H1>H0)
- 3*(H2=maxH5)*(H2>maxH2)
- 2*(H3=maxH5)*(H3>maxH3)
- 1*(H4=maxH5)*(H4>maxH4)

Ken Powers
aka "alatar"