Traders Laboratory - View Single Post - Various Indicators (Squeeze,2FastMa's,etc)
View Single Post
  #12 (permalink)  
Old 04-16-2008, 03:56 AM
Blu-Ray's Avatar
Blu-Ray Blu-Ray is offline
Blu-Ray has no status.

Trader Specs
 
Join Date: Nov 2006
Location: England
Posts: 427
Thanks: 105
Thanked 53 Times in 34 Posts
This member is the original thread starter. Re: Various Indicators (Squeeze,2FastMa's,etc)

My Apologies, it requires the jtHMA function which I forgot to post the code, so here it is:

{jtHMA - Hull Moving Average Function}
{Author: Atavachron}
{May 2005}

Inputs: price(NumericSeries), length(NumericSimple);
Vars: halvedLength(0), sqrRootLength(0);

{
Original equation is:
---------------------
waverage(2*waverage(close ,period/2)-waverage(close,period), SquareRoot(Period)
Implementation below is more efficient with lengthy Weighted Moving Averages.
In addition, the length needs to be converted to an integer value after it is halved and
its square root is obtained in order for this to work with Weighted Moving Averaging
}

if ((ceiling(length / 2) - (length / 2)) <= 0.5) then
halvedLength = ceiling(length / 2)
else
halvedLength = floor(length / 2);

if ((ceiling(SquareRoot(leng th)) - SquareRoot(length)) <= 0.5) then
sqrRootLength = ceiling(SquareRoot(length ))
else
sqrRootLength = floor(SquareRoot(length)) ;

Value1 = 2 * WAverage(price, halvedLength);
Value2 = WAverage(price, length);
Value3 = WAverage((Value1 - Value2), sqrRootLength);

jtHMA = Value3;


Hope this helps

Blu-Ray

__________________
Remember - Take the path of least resistance.
Reply With Quote