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

Notification

Icon
Error

Options
Go to last post Go to first unread
uhehs  
#1 Posted : Friday, October 8, 2010 11:35:42 AM(UTC)
uhehs

Rank: Newbie

Groups: Registered, Registered Users
Joined: 5/25/2005(UTC)
Posts: 8
Location: Southbury, CT

After extensive use of a search engine (no plug here!) i am having difficulty getting a good brief description of what HURST developed - Also finding any code I can plug into Metastock to try. Someone please assist with any information.
johnl  
#2 Posted : Saturday, October 9, 2010 7:55:48 PM(UTC)
johnl

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Might start with:
Hurst - The Profit Magic of Stock Transaction Timing
might be able to find it on the internet.
I always thought he used cycle analysis and channels which opens up a larger can of worms since there are a lot of ways to use cycles and channels to time your trades.




Derek Worswick  
#3 Posted : Thursday, November 4, 2010 11:21:48 AM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

I hope this helps { Hurst Channels }
CY1:= Input("Short Cycle length",1,1000,10 )/2; CY2:= Input("Medium Cycle length",1,1000,80 )/2; M1:= Input("Short Cycle Multiplier",.01,10 ,1 ); M2:= Input("Medium Cycle Multiplier",.01,10,3 ); T1:= Ref(Mov( CLOSE ,CY1 ,TRI ),CY1/2)+ M1*ATR(CY1 ); B1:= Ref(Mov( CLOSE ,CY1 ,TRI ),CY1/2)- M1*ATR(CY1 ); T2:= Ref(Mov( CLOSE ,CY2 ,TRI ),CY2/2)+ M2*ATR(CY2 ); B2:= Ref(Mov( CLOSE ,CY2 ,TRI ),CY2/2)- M2*ATR(CY2 ); T1;B1;T2;B2;
Derek
henry1224  
#4 Posted : Thursday, November 4, 2010 1:41:24 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)
Derek,

Stop using Forward ref in indicators

UserPostedImage

UserPostedImage


The first chart used a 21 period band with a .75 multiplier from your original formula

but check out the far right edge of the chart!

Something's missing

The second chart is your formula but using regular Ref functions

quite a bit of a difference

the first chart uses hindsight where as the second chart has the info you need for the trade
Derek Worswick  
#5 Posted : Thursday, November 4, 2010 1:49:57 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Dear Henry, Thank you for your help. Kind regards, Derek
Derek Worswick  
#6 Posted : Thursday, November 4, 2010 2:03:18 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Henry, Could you please tell me how you insert screen shots into Equis Forum and the format that must be used? Kind regards, Derek
henry1224  
#7 Posted : Thursday, November 4, 2010 2:11:26 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)
Derek,

on an open chart in Metastock, click Print Screen.

use the Paint program in windows click new,and then control+V

save as a gif

go to www.imgur.com

upload your chart from your pc

once uploaded click on the picture and highlight the the code in the message box and paste that into the forum
henry1224  
#8 Posted : Thursday, November 4, 2010 2:13:53 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)
the correct code without forward Ref's

{ Hurst Channels }

----------------------------------------------------------

CY1:= Input("Short Cycle length",1,1000,10 )/2;
CY2:= Input("Medium Cycle length",1,1000,80 )/2;
M1:= Input("Short Cycle Multiplier",.01,10 ,1 );
M2:= Input("Medium Cycle Multiplier",.01,10,3 );
T1:= Ref(Mov( CLOSE ,CY1 ,TRI ),-CY1/2)+ M1*ATR(CY1 );
B1:= Ref(Mov( CLOSE ,CY1 ,TRI ),-CY1/2)- M1*ATR(CY1 );
T2:= Ref(Mov( CLOSE ,CY2 ,TRI ),-CY2/2)+ M2*ATR(CY2 );
B2:= Ref(Mov( CLOSE ,CY2 ,TRI ),-CY2/2)- M2*ATR(CY2 );
T1;B1;T2;B2;

----------------------------------------------------------
Derek Worswick  
#9 Posted : Thursday, November 4, 2010 2:18:41 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Henry, Thank you for the help on attaching screen shots to Equis Forum. Hurst Bands
pds:= Input("LR Periods",10,100,41); a:= Input("Stdev Periods",10,100,30); s1:=Input("Smoothing Periods",2,50,10); r:=LinearReg(C,pds); x:=Mov(r,s1,S); x1 :=x+1*Stdev(C,a); x2 :=x+2*Stdev(C,a); x3 :=x+3*Stdev(C,a); y1:= x-1*Stdev(C,a); y2:= x-2*Stdev(C,a); y3:= x-3*Stdev(C,a); x; x1; x2; x3; y1; y2; y3;
Derek Worswick  
#10 Posted : Wednesday, November 10, 2010 2:35:50 PM(UTC)
Derek Worswick

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 8/11/2005(UTC)
Posts: 104

Catano  
#11 Posted : Friday, May 4, 2012 1:50:30 PM(UTC)
Catano

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/25/2005(UTC)
Posts: 7

Hello,

i have the Hurst Channel in Multicharts, but the Indicator looks not like this one. Can you tell me what this Code is in MEtastock?

Here is the Multicharts Code (Easy Language)

[LegacyColorValue = TRUE];

{Hurst_Channel Indicator}

Input: Price1(MedianPrice of Data1);
Input: Length1(10),
ChanWid1(1); {Multiplier for ATR is positive }
{Percent*100 of Current price if Negative}
Input: Price2(MedianPrice of Data1);
Input: Length2(60),
ChanWid2(3);
Input: CompMode(0); {Compute mode for extension}
{0 = CMA shortening }
{>0= 2nd degree polynomial }
Input: StopDate(0);

Vars: ChanHi1(0), ChanLo1(0), WidChan1(Iff(ChanWid1>0,ChanWid1,-ChanWid1*.001)),
Ave1(0), ATR1(0),
SetBack1(IntPortion((Length1-1)/2)+1);
Vars: ChanHi2(0), ChanLo2(0), WidChan2(Iff(ChanWid2>0,ChanWid2,-ChanWid2*.001)),
Ave2(0), ATR2(0),
SetBack2(IntPortion((Length2-1)/2)+1);
Vars: DateStop(iff(stopdate<=0,1211231,StopDate)),Ipass(0);


If Length1>0 and Ipass=0 then begin

Ave1 = Average(Price1,Length1);
If ChanWid1>0
then ATR1 = AvgTrueRange(Length1)
else ATR1 = C;
ChanHi1= Ave1+ATR1*WidChan1;
ChanLo1= Ave1-ATR1*WidChan1;


Plot1[SetBack1](ChanHi1,"HH1");
Plot2[SetBack1](ChanLo1,"HL1");

If LastBarOnChart or Date>=DateStop then Begin
Value5 = (Ave1-Ave1[SetBack1])/SetBack1;
For Value1 = SetBack1-1 downto 0 begin
Value3=0;
Value4=Value1*2;
For Value2=0 to Value4 begin
Value3=Value3+Price1[Value2];
End;
Ave1=Value3/(Value4+1);
If CompMode>0 then Ave1=Ave1*.33+(Ave1[1]+Value5*(SetBack1-Value1))*.67;
ChanHi1= Ave1+ATR1*WidChan1;
ChanLo1= Ave1-ATR1*WidChan1;
Plot1[Value1](ChanHi1,"HH1");
Plot2[Value1](ChanLo1,"HL1");
End;
If Length2=0 then IPass=1;
End;
End;



{Now for second channel}
If Length2>0 and Ipass=0 then begin
Ave2 = Average(Price2,Length2);
If ChanWid2>0
then ATR2 = AvgTrueRange(Length2)
else ATR2 = C;
ChanHi2= Ave2+ATR2*WidChan2;
ChanLo2= Ave2-ATR2*WidChan2;

Plot3[SetBack2](ChanHi2,"HH2");
Plot4[SetBack2](ChanLo2,"HL2");

If LastBarOnChart or Date>=DateStop then Begin
Value5 = (Ave2-Ave2[SetBack2])/SetBack2;
For Value1 = SetBack2-1 downto 0 begin
Value3=0;
Value4=Value1*2;
For Value2=0 to Value4 begin
Value3=Value3+Price2[Value2];
End;
Ave2=Value3/(Value4+1);
If CompMode>0 then Ave2=Ave2*.33+(Ave2[1]+Value5*(SetBack2-Value1))*.67;
ChanHi2= Ave2+ATR2*WidChan2;
ChanLo2= Ave2-ATR2*WidChan2;
Plot3[Value1](ChanHi2,"HH2");
Plot4[Value1](ChanLo2,"HL2");
End;
IPass=1;
End;
End;

Best reards
wabbit  
#12 Posted : Friday, May 4, 2012 6:52:31 PM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Catano wrote:
Can you tell me what this Code is in MEtastock?



Code:

this is a misnomer, keep reading...
{Hurst_Channel Indicator} 

-- these is the user input area where the user gets to set various parameters --
SECTION 1 values
Input: Price1(MedianPrice of Data1);
Input: Length1(10),
 ChanWid1(1); {Multiplier for ATR is positive }
 {Percent*100 of Current price if Negative}

SECTION 2 values
Input: Price2(MedianPrice of Data1);
Input: Length2(60),
 ChanWid2(3);

these apply to both sections
Input: CompMode(0); {Compute mode for extension}
 {0 = CMA shortening }
 {>0= 2nd degree polynomial }
Input: StopDate(0);

this is the variable declaration area - not required in MS
Vars: ChanHi1(0), ChanLo1(0), WidChan1(Iff(ChanWid1>0,ChanWid1,-ChanWid1*.001)),
 Ave1(0), ATR1(0),
 SetBack1(IntPortion((Length1-1)/2)+1);
Vars: ChanHi2(0), ChanLo2(0), WidChan2(Iff(ChanWid2>0,ChanWid2,-ChanWid2*.001)),
 Ave2(0), ATR2(0),
 SetBack2(IntPortion((Length2-1)/2)+1);
Vars: DateStop(iff(stopdate<=0,1211231,StopDate)),Ipass(0);

-- SECTION 1 --
If Length1>0 and Ipass=0 then begin
 
 Ave1 = Average(Price1,Length1);
 If ChanWid1>0
 then ATR1 = AvgTrueRange(Length1)
 else ATR1 = C;
 ChanHi1= Ave1+ATR1*WidChan1;
 ChanLo1= Ave1-ATR1*WidChan1;
 
 this is a SMA with an ATR channel width, ala Keltner Bands and VERY similar to the results to the code posted years ago in the thread above
 Plot1[SetBack1](ChanHi1,"HH1");
 Plot2[SetBack1](ChanLo1,"HL1");
 
 this is for forecasting past the last selected date or the last bar
 only plots if CompMode>0
 If LastBarOnChart or Date>=DateStop then Begin
 Value5 = (Ave1-Ave1[SetBack1])/SetBack1;
 For Value1 = SetBack1-1 downto 0 begin
 Value3=0;
 Value4=Value1*2;
 For Value2=0 to Value4 begin
 Value3=Value3+Price1[Value2];
 End;
 Ave1=Value3/(Value4+1);
 If CompMode>0 then Ave1=Ave1*.33+(Ave1[1]+Value5*(SetBack1-Value1))*.67; this is not a 2nd degree polynomial, it's a form of IIR filter (EMA)
 ChanHi1= Ave1+ATR1*WidChan1;
 ChanLo1= Ave1-ATR1*WidChan1;
 Plot1[Value1](ChanHi1,"HH1");
 Plot2[Value1](ChanLo1,"HL1");
 End;
 If Length2=0 then IPass=1;
 End;
End;


-- SECTION 2 --
just a repeat of SECTION 1 to draw a second set of bands, with the second set of user parameters
{Now for second channel}
If Length2>0 and Ipass=0 then begin
 Ave2 = Average(Price2,Length2);
 If ChanWid2>0
 then ATR2 = AvgTrueRange(Length2)
 else ATR2 = C;
 ChanHi2= Ave2+ATR2*WidChan2;
 ChanLo2= Ave2-ATR2*WidChan2;
 
 Plot3[SetBack2](ChanHi2,"HH2");
 Plot4[SetBack2](ChanLo2,"HL2");
 
 If LastBarOnChart or Date>=DateStop then Begin
 Value5 = (Ave2-Ave2[SetBack2])/SetBack2;
 For Value1 = SetBack2-1 downto 0 begin
 Value3=0;
 Value4=Value1*2;
 For Value2=0 to Value4 begin
 Value3=Value3+Price2[Value2];
 End;
 Ave2=Value3/(Value4+1);
 If CompMode>0 then Ave2=Ave2*.33+(Ave2[1]+Value5*(SetBack2-Value1))*.67;
 ChanHi2= Ave2+ATR2*WidChan2;
 ChanLo2= Ave2-ATR2*WidChan2;
 Plot3[Value1](ChanHi2,"HH2");
 Plot4[Value1](ChanLo2,"HL2");
 End;
 IPass=1;
 End;
End;
So, this plots a variant of Keltner Bands... It's "odd" code anyway... personally I would not have chosen to write it like this. wabbit [:D]
Catano  
#13 Posted : Saturday, May 5, 2012 4:12:47 AM(UTC)
Catano

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/25/2005(UTC)
Posts: 7

Hello Wabbit,

many thx. Please look here, these are the Settings.

http://www.bilderload.com/bild/202760/hurstchannelT9RTP.gif

Best regards
wabbit  
#14 Posted : Saturday, May 5, 2012 6:17:19 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
Code:

l1:=3;
m1:=1;
l2:=80;
m2:=3;

data:=mp();

mid1:=mov(data,l1,s);
mid2:=mov(data,l2,s);

atr1:=atr(l1);
atr2:=atr(l2);

ul1:=mid1+m1*atr1;
ll1:=mid1-m1*atr1;

ul2:=mid2+m2*atr2;
ll2:=mid2-m2*atr2;

{plot}
ul1;ll1;
ul2;ll2;




wabbit [:D]

P.S. I must be having a 'good' day to do this for you -- there isn't anything here which you could not have done yourself after reading the manual, the free Equis formula primer and the posts above. Next time, you might not be so lucky?

Catano  
#15 Posted : Saturday, May 5, 2012 7:37:21 AM(UTC)
Catano

Rank: Newbie

Groups: Registered, Registered Users
Joined: 10/25/2005(UTC)
Posts: 7

Hello Wabbit,

many thankgs for your help. Can you tell me, why there is a difference between Metastock and Multicharts. Please look at the two charts.

http://www.bilderload.com/bild/202843/daxhurstAPH33.gif

http://www.bilderload.com/daten/hurstchannel2ULCYP.gif

Best regards




wabbit  
#16 Posted : Saturday, May 5, 2012 10:29:31 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
There are actually two differencees:

The first is that MultiCharts uses EL functions; the EL AvgTrueRange function is not the same as the MS ATR() function.

The second is the shift in the indicator which I omitted from my code, but I now notice the EL/MC code is FORWARD REFERENCED? Or is it because it's really late here and my eyes and care for this project have been exhausted?

Code:

l1:=3;
m1:=1;
l2:=80;
m2:=3;

mid1:=Mov(MP(),l1,S);
mid2:=Mov(MP(),l2,S);

r1:=H-L;
r2:=Abs(H-Ref(C,-1));
r3:=Abs(Ref(C,-1)-L);
tr:=Max(Max(r1,r2),r3);

atr1:=Mov(tr,l1,S);
atr2:=Mov(tr,l2,S);

ul1:=mid1+m1*atr1;
ll1:=mid1-m1*atr1;

ul2:=mid2+m2*atr2;
ll2:=mid2-m2*atr2;

sb1:=LastValue(Int((l1-1)/2)+1);
sb2:=LastValue(Int((l2-1)/2)+1);

{plot}
Ref(ul1,sb1);Ref(ll1,sb1);
Ref(ul2,sb2);Ref(ll2,sb2);



wabbit [:D]

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.