logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
JonRoberts  
#1 Posted : Saturday, July 9, 2005 8:45:35 PM(UTC)
JonRoberts

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/22/2005(UTC)
Posts: 31

I've beat my head against the wall until I have no walls left, and cannot figure out how to get this custom indicator to work. :? Thus, I'm asking for some help. I'm probably going to find out it's quite simple! :shock: What I'm trying to do is be able to plot the arithmetic average of the highest high value within different periods. For example, suppose I want to use a 120-period lookback and I want the average of the highest highs within 3 equally spaced periods within that 120 periods. Equally spaced periods are 40 periods each. Thus, the first highest high value (HHV1) will be the HHV for periods 1-40; The second highest high value (HHV2) will be the HHV for the periods 41-80; The third highest high value (HHV3) will be the HHV for the periods 81-120. The acutal value I want to plot will be the arithmetic average of HHV1, HHV2, and HHV3, i.e. (HHV1+HHV2+HHV3)/3. HHV1 is quite simple to do in MS, but for the life of me I cannot figure out how to get MS to do a HHV in a period range that doesn't start with the current value! Thanks for all your help! Jon
henry1224  
#2 Posted : Saturday, July 9, 2005 10:37:42 PM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
I think this is what your looking for HHV1:=HHV(H,40); HHV2:=Ref(HHV(H,40),-40); HHV3:=Ref(HHV(H,40),-80); HHVA:=(HHV1+HHV2+HHV3)/3; HHV1;HHV2;HHV3;HHVA; The first line is the most recent HHV 40 The second line is the second recent HHV 40 The third line is the third recent HHV 40 The fourth line is the average
JonRoberts  
#3 Posted : Saturday, July 9, 2005 11:02:05 PM(UTC)
JonRoberts

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/22/2005(UTC)
Posts: 31

Thanks so much, henry! This is EXACTLY what I am looking for! Now I just need to go patch up my walls and I'll be all set :D
henry1224  
#4 Posted : Sunday, July 10, 2005 12:24:38 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
If you would share your ideas for this indicator?
JonRoberts  
#5 Posted : Sunday, July 10, 2005 12:38:46 AM(UTC)
JonRoberts

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/22/2005(UTC)
Posts: 31

I'd be happy to share why I asked this question, Henry! I have studied the book "Trading with DiNapoli Levels" by Joe DiNapoli and have found some success in his concepts. One of the indicators he uses is his Detrended Oscillator, which the difference between the close and a 7-day MA of the close. DiNapoli considers overbought/oversold conditions to be when his DO is approximately 70% of the average DO highs/lows over the past six months or so. It's that six month average that was throwing me for a loop. While it's easy to "eye-ball" what the average is, I'm kind of a tinkerer and was trying to come up with an indicator that would plot the six-month DO average highs and lows for me. If you or anyone else is interested, here is what I've come up with: {This indicator plots DiNapoli’s Detrended Oscillator (which is his overbought/oversold indicator) and the average values of the peaks and troughs for the previous N periods. DiNapoli recommends N being approximately 6 months, thus the default setting is 120 days. For weekly charts, change the input period to 24 weeks. To determine the average highs and lows, the N-period lookback is divided into six equal parts, each having a length of N/6. The highest high value and the lowest low value within each of those six parts is then averaged. Overbought/oversold conditions are reached when the DO reaches approximately 70% of the 6-month average.} N := Input("DO Lookback Period",1,250,120); DDOPeriod:=N/6; {Calculate Dinapoli’s DO} DDO:= C-Mov(C,7,S); {Determine the highest high value of DO for each DDOPeriod.} HHV1:=HHV(DDO, DDOPeriod); HHV2:=Ref(HHV(DDO, DDOPeriod),-DDOPeriod ); HHV3:=Ref(HHV(DDO, DDOPeriod),-2* DDOPeriod ); HHV4:=Ref(HHV(DDO, DDOPeriod),-3* DDOPeriod ); HHV5:=Ref(HHV(DDO, DDOPeriod),-4* DDOPeriod ); HHV6:=Ref(HHV(DDO, DDOPeriod),-5* DDOPeriod ); {Calculate the average of the highest highs} HHVA:=(HHV1+HHV2+HHV3+HHV4+HHV5+HHV6)/6; {Determine the lowest low value of DO for each DDOPeriod.} LLV1:=LLV(DDO, DDOPeriod); LLV2:=Ref(LLV(DDO, DDOPeriod),-DDOPeriod ); LLV3:=Ref(LLV(DDO, DDOPeriod),-2* DDOPeriod ); LLV4:=Ref(LLV(DDO, DDOPeriod),-3* DDOPeriod ); LLV5:=Ref(LLV(DDO, DDOPeriod),-4* DDOPeriod ); LLV6:=Ref(LLV(DDO, DDOPeriod),-5* DDOPeriod ); {Calculate the average of the lowest lows} LLVA:=(LLV1+LLV2+LLV3+LLV4+LLV5+LLV6)/6; {Plot the DO, highest high average, and lowest low average} DDO; Ref(HHVA,-1); Ref(LLVA,-1)
henry1224  
#6 Posted : Sunday, July 10, 2005 12:48:25 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
HHV1:=HHV(H,40); HHV2:=Ref(HHV(H,40),-40); HHV3:=Ref(HHV(H,40),-80); HHVA:=(HHV1+HHV2+HHV3)/3; LLV1:=LLV(L,40); LLV2:=Ref(LLV(L,40),-40); LLV3:=Ref(LLV(L,40),-80); LLVA:=(LLV1+LLV2+LLV3)/3; HHVA;LLVA;
henry1224  
#7 Posted : Sunday, July 10, 2005 1:58:38 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
DDO:= C-Mov(C,7,S); HHV1:=HHV(DDO, 20); HHV2:=Ref(HHV(DDO, 20),-20); HHV3:=Ref(HHV(DDO, 20),-2*20); HHV4:=Ref(HHV(DDO, 20),-3*20); HHV5:=Ref(HHV(DDO, 20),-4*20); HHV6:=Ref(HHV(DDO, 20),-5*20); HHVA:=(HHV1+HHV2+HHV3+HHV4+HHV5+HHV6)/6; LLV1:=LLV(DDO, 20); LLV2:=Ref(LLV(DDO, 20),-20); LLV3:=Ref(LLV(DDO, 20),-2*20); LLV4:=Ref(LLV(DDO, 20),-3*20); LLV5:=Ref(LLV(DDO, 20),-4*20); LLV6:=Ref(LLV(DDO, 20),-5*20); LLVA:=(LLV1+LLV2+LLV3+LLV4+LLV5+LLV6)/6; HHV1:=HHV(H,40); HHV2:=Ref(HHV(H,40),-40); HHV3:=Ref(HHV(H,40),-80); HHVA1:=(HHV1+HHV2+HHV3)/3; LLV1:=LLV(L,40); LLV2:=Ref(LLV(L,40),-40); LLV3:=Ref(LLV(L,40),-80); LLVA1:=(LLV1+LLV2+LLV3)/3; Over:=H>HHVA1 and DDO>Ref(HHVA,-1); Under:=L<LLVA1 and DDO<Ref(LLVA,-1); If(Over,1,If(Under,-1,0))
JonRoberts  
#8 Posted : Sunday, July 10, 2005 1:32:59 PM(UTC)
JonRoberts

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 3/22/2005(UTC)
Posts: 31

Thanks much, henry. I'll take a look. I appreciate all of your help!
Users browsing this topic
Guest (Hidden)
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.