HTPhasor's return value, and suggestions for the manual

Posted By: GPEngine

HTPhasor's return value, and suggestions for the manual - 07/09/14 14:20

returns a var
but what is the value? The manual doesn't say.
same with HTSine.

Also, I feel that MedPrice, TypPrice, and WCLPrice belong on the "price" page of the manual rather than the Indicators page.
Posted By: jcl

Re: HTPhasor's return value, and suggestions for the manual - 07/09/14 18:26

I'm afraid I can't help much with HTPhasor - my guess is as good as yours. The HT indicators are from the "Rocket Science" book by Ehlers. It would be difficult to interpret them without the context of that book.
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/11/14 05:18

Does the source code for HTSine, etc., live somewhere I can see? On p. 125 he adjusts one of the WMA periods. I would like to try that.

Additionally the manual claims that HTDcPeriod is slightly less accurate than the DominantPeriod function. What data do you have that supports this claim? Can you share it?
Posted By: jcl

Re: HTPhasor's return value, and suggestions for the manual - 07/11/14 06:27

Yes, the source of all indicators is online, and linked on the indicators page.

I've tested HTDcPeriod with chirps and found it inferior to DominantPeriod. Ehlers uses a different method in his newest book, based on an autocorrelation spectrum. That one I have not tested yet.
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/11/14 14:06

I meant the source code in lite-c in Zorro framework
I have the book, so I have the source code in EasyLanguage. I'm 'bout to translate it, I guess.
Posted By: jcl

Re: HTPhasor's return value, and suggestions for the manual - 07/11/14 14:39

The source code is C++, not lite-C.
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/12/14 04:41

Das ist komplizierter als ich dachte. laugh
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/12/14 19:10

I found ta_HT_DCPERIOD.c and ta_HT_DCPHASE.c, etc.
I see a couple problems

1.
In ta_HT_DCPHASE, on line 427 is
else if( tempReal <= 0.01 )
should be
else if( tempReal <= 0.001 )
ref Ehlers p. 122

2.
In several places, a comment says "idx" is used to iterate for up to 50 of the last value of smoothPrice. By code inspection, that's not true. What it actually does is rotate through last 50 values, starting over at end of the smoothPrice array each time 0 is reached. Anyway, that's not in the book.
Code:
/* idx is used to iterate for up to 50 of the last
       * value of smoothPrice.
       */
      idx = smoothPrice_Idx;
      for( i=0; i < DCPeriodInt; i++ )
      {
         tempReal  = ((double)i*constDeg2RadBy360)/(double)DCPeriodInt;
         tempReal2 = smoothPrice[idx];
         realPart += std_sin(tempReal)*tempReal2;
         imagPart += std_cos(tempReal)*tempReal2;
         if( idx == 0 )
            idx = SMOOTH_PRICE_SIZE-1;
         else
            idx--;
      }


Since that code smells funny, I look a little closer. whats this... RealPart should accumulate cos(x / period), and the ImagPart should accumulate sin(x / period). I think the coder got sin & cos confused. ref Ehlers p. 122

That fragment is untouched since the first check-in http://sourceforge.net/p/ta-lib/code/139/

I realize that this is not your code. But I thought you might be interested anyway. so you don't blame ehlers algos for what may actually be an implementation issue (or three).
Posted By: jcl

Re: HTPhasor's return value, and suggestions for the manual - 07/14/14 14:10

Thanks a lot, this is an interesting discovery. I have never verified the ta-lib source, but the HTDcPeriod returned periods that looked correct, althoug less precise and more noise sensitive than DominantPeriod.

I'll check and then possibly remove the HT functions from the indicator list in the documentation.
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/24/14 04:54

I found another transcription error.

http://sourceforge.net/p/ta-lib/code/HEAD/tree/trunk/ta-lib/c/src/ta_func/ta_HT_TRENDMODE.c#l446
Code:
else if( tempReal <= 0.01 )
      {
         if( realPart < 0.0 )
            DCPhase -= 90.0;
         else if( realPart > 0.0 )
            DCPhase += 90.0;
      }



That is supposed to say
Code:
else if( tempReal <= 0.01 )
      {
         if( imagPart < 0.0 )
            DCPhase -= 90.0;
         else if( imagPart > 0.0 )
            DCPhase += 90.0;
      }


Since the EasyLanguage code on p102 says
Code:
If AbsValue(RealPart) <= 0.001 then DCPhase = 90 * Sign(ImagPart);


(not realPart).
Sloppy!
Posted By: GPEngine

Re: HTPhasor's return value, and suggestions for the manual - 07/24/14 05:27

Ugh.
http://www.mesasoftware.com/bookcompanions.htm See section "ROCKET SCIENCE FOR TRADERS"

All of the differences I've identified are actually errata.

I still think re-cycling 50 bars of Smooth was probably not what the author intended. but it probably doesn't have a big impact. Period is rarely over 50.
© 2024 lite-C Forums