[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Translation code of H.E. Hurst Coefficient by Ehlers from TS to AM


  • Date: Tue, 16 Feb 2010 11:16:09 -0500
  • From: Ted Byers <r.ted.byers@xxxxxxxxx>
  • Subject: Re: [amibroker] Translation code of H.E. Hurst Coefficient by Ehlers from TS to AM

PureBytes Links

Trading Reference Links



I don't mean to rain on your parade, but the notion of using something I don't know much about is something I find 'scary'.

I would suggest you find out, and delve into the math behind it, before making much use of it.

Examine it thoroughly, experiment with it enough to satisfy yourself you can make good use of it.  The Hurst exponent is based on fascinating scientific work, and is an intriguing idea.  But I am not yet convinced there are adequate algorithms available to compute it reliably, or that the math is adequately developed, to allow it to be used well.

For the Hurst coefficient, there are, in fact, several different algorithms for computing it, and these different algorithms rarely agree.  I have written code (Java, C++) to compute it, but I do not trust the numbers  any of these algorithms produce for any applied purpose.  Therefore, I simply do not apply them in code I write that others may use to manage their trading/investing.  I wil not put other people's money at risk by letting them use math/algorithms I am not happy with.  And I will not until I have sufficiently analyzed both the math and the algorithms behind the Hurst coefficient to the point I know why the available algorithms give different results.

FTR, I am the sort of individual that writes tens of thousands of lines of code to do statistical analysis before trusting a readily available stats package, and then still write code to provide diagnostics that such packages typically don't provide.  And my QA code typically applies my number crunching code to tens of millions of randomly generated test cases, requiring the result to have the expected mathematical properties: every analysis has a well defined suite of assumptions and mathematical properties, and my QA code tests every one of them.  I do not regard my code ready to be released unless it passes every one of these tests, and that includes giving error messages when the data it is applied to violates one or more of the assumptions inherent in the algorithm.  I know some in the software development industry who would regard my standards as too cautious or conservative, but given that my code has been used in risk management in the environmental consulting industry, including the management of risk related to the nuclear industry, I tend to be paranoid about the quality of my code.  Really bad things can happen if it fails!  So take my opinion for what its worth abd be aware some, perhaps many, will disagree with me.

HTH

Ted

On Tue, Feb 16, 2010 at 10:45 AM, Joe Landry <jelandry@xxxxxxxxxxxxx> wrote:
 



Sorry I don't know enough to know the difference. 
 
Joe L.
 
 
----- Original Message -----
Sent: Tuesday, February 16, 2010 8:41 AM
Subject: Re: [amibroker] Translation code of H.E. Hurst Coefficient by Ehlers from TS to AM

 

There are 3 indicators in AFL Library
- Cycle Highlighter,
- Hurst "Like" DE,
- Hurst Constant,
but none of them is the indicator based on H.E. Hurst coefficient (not J.M. Hurst) like Ehlers does with his method.  




--- 16.2.10 (Wt), Joe Landry <jelandry@xxxxxxxxxxxxx> napisał(a):

Od: Joe Landry <jelandry@xxxxxxxxxxxxx>
Temat: Re: [amibroker] Translation code of H.E. Hurst Coefficient by Ehlers from TS to AM
Do: amibroker@xxxxxxxxxxxxxxx
Data: 16 Luty 2010 (Wtorek), 11:54

 

Not many months ago there was a lot of work about Hurst methodology published on the Amibroker board. Have you searched the library? Or the forum archives?
 
JOE L.  
----- Original Message -----
From: cichy1235
Sent: Tuesday, February 16, 2010 4:31 AM
Subject: [amibroker] Translation code of H.E. Hurst Coefficient by Ehlers from TS to AM

 

I need help with translation code of H.E. Hurst Coefficient by John Ehlers from Tradestation to Amibroker...

Original TS code is as follow:

Inputs:
Price((H+L)/ 2),
Lookback(60) ;

Vars:
I(0),
N(0),
count(0),
N1(0),
N2(0),
N3(0),
HH(0),
LL(0),
Dimen(0),
Color1(0),
Color2(0),
Color3(0),
PlotLen(0);

Arrays:
H[190](0), H1[100](0), H2[100](0), H3[100](0), H4[100](0), HAvg[100](0) ;

For I = 1 to 50 Begin
N = 2*I;
N3 = (Highest(High, N) - Lowest(Low, N)) / N;
HH = High;
LL = Low;
For count = 0 to N/2 - 1 begin
If High[count] > HH then HH = High[count];
If Low[count] < LL then LL = Low[count];
End;
N1 = (HH - LL)/(N / 2);
HH = High[N/2];
LL = Low[N/2];
For count = N/2 to N - 1 begin
If High[count] > HH then HH = High[count];
If Low[count] < LL then LL = Low[count];
End;
N2 = (HH - LL)/(N / 2);

If N1 > 0 and N2 > 0 and N3 > 0 then Dimen = (Log(N1 + N2) - Log(N3)) / Log(2);
H[N] = 2*(1 / Dimen - .5);
H[N] = 1.25*(H[N] - .5) + .6;
HAvg[N] = (H[N] + H1[N] + H2[N] + H3[N] + H4[N]) / 5;
If HAvg[N] > 1 then HAvg[N] = 1;
If HAvg[N] < 0 then HAvg[N] = 0;
H4[N] = H3[N];
H3[N] = H2[N];
H2[N] = H1[N];
H1[N] = H[N];
End;
For I = 2 to 50 Begin
N = 2*I - 1;
HAvg[N] = (HAvg[N - 1] + HAvg[N + 1]) / 2;
End;

//Plot the Rescale-range Statistic as a Heatmap
PlotLen = Lookback;
If Plotlen > 99 Then PlotLen = 99;
For I = 8 to PlotLen Begin
//Convert RS to RGB Color for Display
If HAvg[I] >= .5 Then Begin
Color1 = 255*(2 - 2*HAvg[I]);
Color2 = 255*(2*HAvg[ I] - 1);
Color3 = 0;
End
Else If HAvg[I] < .5 Then Begin
Color1 = 255*(2*HAvg[ I]);
Color2 = 0;
Color3 = 255*(1 - 2*HAvg[I]);
End;
If I = 4 Then Plot4(4, "S4", RGB(Color1, Color2, Color3),0,4) ;
If I = 5 Then Plot5(5, "S5", RGB(Color1, Color2, Color3),0,4) ;
If I = 6 Then Plot6(6, "S6", RGB(Color1, Color2, Color3),0,4) ;
If I = 7 Then Plot7(7, "S7", RGB(Color1, Color2, Color3),0,4) ;
If I = 8 Then Plot8(8, "S8", RGB(Color1, Color2, Color3),0,4) ;
If I = 9 Then Plot9(9, "S9", RGB(Color1, Color2, Color3),0,4) ;
If I = 10 Then Plot10(10, "S10", RGB(Color1, Color2, Color3),0,4) ;
If I = 11 Then Plot11(11, "S11", RGB(Color1, Color2, Color3),0,4) ;
If I = 12 Then Plot12(12, "S12", RGB(Color1, Color2, Color3),0,4) ;
If I = 13 Then Plot13(13, "S13", RGB(Color1, Color2, Color3),0,4) ;
If I = 14 Then Plot14(14, "S14", RGB(Color1, Color2, Color3),0,4) ;
If I = 15 Then Plot15(15, "S15", RGB(Color1, Color2, Color3),0,4) ;
If I = 16 Then Plot16(16, "S16", RGB(Color1, Color2, Color3),0,4) ;
If I = 17 Then Plot17(17, "S17", RGB(Color1, Color2, Color3),0,4) ;
If I = 18 Then Plot18(18, "S18", RGB(Color1, Color2, Color3),0,4) ;
If I = 19 Then Plot19(19, "S19", RGB(Color1, Color2, Color3),0,4) ;
If I = 20 Then Plot20(20, "S20", RGB(Color1, Color2, Color3),0,4) ;
If I = 21 Then Plot21(21, "S21", RGB(Color1, Color2, Color3),0,4) ;
If I = 22 Then Plot22(22, "S22", RGB(Color1, Color2, Color3),0,4) ;
If I = 23 Then Plot23(23, "S23", RGB(Color1, Color2, Color3),0,4) ;
If I = 24 Then Plot24(24, "S24", RGB(Color1, Color2, Color3),0,4) ;
If I = 25 Then Plot25(25, "S25", RGB(Color1, Color2, Color3),0,4) ;
If I = 26 Then Plot26(26, "S26", RGB(Color1, Color2, Color3),0,4) ;
If I = 27 Then Plot27(27, "S27", RGB(Color1, Color2, Color3),0,4) ;
If I = 28 Then Plot28(28, "S28", RGB(Color1, Color2, Color3),0,4) ;
If I = 29 Then Plot29(29, "S29", RGB(Color1, Color2, Color3),0,4) ;
If I = 30 Then Plot30(30, "S30", RGB(Color1, Color2, Color3),0,4) ;
If I = 31 Then Plot31(31, "S31", RGB(Color1, Color2, Color3),0,4) ;
If I = 32 Then Plot32(32, "S32", RGB(Color1, Color2, Color3),0,4) ;
If I = 33 Then Plot33(33, "S33", RGB(Color1, Color2, Color3),0,4) ;
If I = 34 Then Plot34(34, "S34", RGB(Color1, Color2, Color3),0,4) ;
If I = 35 Then Plot35(35, "S35", RGB(Color1, Color2, Color3),0,4) ;
If I = 36 Then Plot36(36, "S36", RGB(Color1, Color2, Color3),0,4) ;
If I = 37 Then Plot37(37, "S37", RGB(Color1, Color2, Color3),0,4) ;
If I = 38 Then Plot38(38, "S38", RGB(Color1, Color2, Color3),0,4) ;
If I = 39 Then Plot39(39, "S39", RGB(Color1, Color2, Color3),0,4) ;
If I = 40 Then Plot40(40, "S40", RGB(Color1, Color2, Color3),0,4) ;
If I = 41 Then Plot41(41, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 42 Then Plot42(42, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 43 Then Plot43(43, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 44 Then Plot44(44, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 45 Then Plot45(45, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 46 Then Plot46(46, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 47 Then Plot47(47, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 48 Then Plot48(48, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 49 Then Plot49(49, "S49", RGB(Color1, Color2, Color3),0,4) ;
If I = 50 Then Plot50(50, "S50", RGB(Color1, Color2, Color3),0,4) ;
If I = 51 Then Plot51(51, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 52 Then Plot52(52, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 53 Then Plot53(53, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 54 Then Plot54(54, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 55 Then Plot55(55, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 56 Then Plot56(56, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 57 Then Plot57(57, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 58 Then Plot58(58, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 59 Then Plot59(59, "S49", RGB(Color1, Color2, Color3),0,4) ;
If I = 60 Then Plot60(60, "S50", RGB(Color1, Color2, Color3),0,4) ;
If I = 61 Then Plot61(61, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 62 Then Plot62(62, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 63 Then Plot63(63, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 64 Then Plot64(64, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 65 Then Plot65(65, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 66 Then Plot66(66, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 67 Then Plot67(67, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 68 Then Plot68(68, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 69 Then Plot69(69, "S49", RGB(Color1, Color2, Color3),0,4) ;
If I = 70 Then Plot70(70, "S50", RGB(Color1, Color2, Color3),0,4) ;
If I = 71 Then Plot71(71, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 72 Then Plot72(72, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 73 Then Plot73(73, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 74 Then Plot74(74, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 75 Then Plot75(75, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 76 Then Plot76(76, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 77 Then Plot77(77, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 78 Then Plot78(78, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 79 Then Plot79(79, "S49", RGB(Color1, Color2, Color3),0,4) ;
If I = 80 Then Plot80(80, "S50", RGB(Color1, Color2, Color3),0,4) ;
If I = 81 Then Plot81(81, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 82 Then Plot82(82, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 83 Then Plot83(83, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 84 Then Plot84(84, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 85 Then Plot85(85, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 86 Then Plot86(86, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 87 Then Plot87(87, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 88 Then Plot88(88, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 89 Then Plot89(89, "S49", RGB(Color1, Color2, Color3),0,4) ;
If I = 90 Then Plot90(90, "S50", RGB(Color1, Color2, Color3),0,4) ;
If I = 91 Then Plot91(91, "S41", RGB(Color1, Color2, Color3),0,4) ;
If I = 92 Then Plot92(92, "S42", RGB(Color1, Color2, Color3),0,4) ;
If I = 93 Then Plot93(93, "S43", RGB(Color1, Color2, Color3),0,4) ;
If I = 94 Then Plot94(94, "S44", RGB(Color1, Color2, Color3),0,4) ;
If I = 95 Then Plot95(95, "S45", RGB(Color1, Color2, Color3),0,4) ;
If I = 96 Then Plot96(96, "S46", RGB(Color1, Color2, Color3),0,4) ;
If I = 97 Then Plot97(97, "S47", RGB(Color1, Color2, Color3),0,4) ;
If I = 98 Then Plot98(98, "S48", RGB(Color1, Color2, Color3),0,4) ;
If I = 99 Then Plot99(99, "S49", RGB(Color1, Color2, Color3),0,4) ;

End;


__________________________________________________
Czy juz jestes w Yahoo!?
Masz dosyc spamu? Poczta Yahoo! dysponuje najlepsza ochrona przed spamem
http://pl.mail.yahoo.com



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___