PureBytes Links
Trading Reference Links
|
No problem Bruce. I got the answer already. Stupid me forgot the ROUND before the Periods/2. Now I am getting the same result ...
Ton.
function HullMaFunction( P, Periods, Delay )
{
X = 2 * WMA(P,round(Periods/2)) - WMA(P,Periods);
HullMA = WMA(X,round(sqrt(Periods)));
HullMA = Ref(HullMA,-Delay);
return HullMa;
}
PlotPriceField = ParamToggle("PriceField","HIDE|SHOW",1);
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 0.2, 10 );
Delay = Param("Delay", 0, -100, 100, 1 );
HullMA = HullMaFunction( P, Periods, Delay );
if( PlotPriceField ) Plot(C,"",1,128);
Plot( HullMA, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),ParamStyle("Style") );
// Question is, what is causing the difference when sliding thru the periods ?
MyHull = ParamToggle("My Hulll","HIDE|SHOW",1);
if( MyHull )
{
MA1=WMA(C,Periods);
MA2=WMA(C,round(Periods/2));
HMA=WMA(2*MA2-MA1,round(sqrt(Periods)));
Plot( HMA, "MyHull", colorBlue,styleLine );
};
----- Original Message -----
From: Bruce Hawkins
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, December 31, 2006 8:49 PM
Subject: Re: [amibroker] Hull Moving Averages
Hi Ton,
I am sorry if I misrepresented, I am not the author of the code I provided, I came across
it somewhere. I am to new to AFL to comment on the differences.
Cheers,
Bruce
Sieverding wrote:
Bruce do you know what is causing the difference between "YourHull" and "MyHull" when changing the period ? Interesting to see that both calculations for certain periods give the same result and for others not. I just don't see the difference from a code point of view ...
Ton.
MA1=WMA(C,Periods);
MA2=WMA(C,Periods/2);
HMA=WMA(2*MA2-MA1,round(sqrt(Periods)));
Plot( HMA, "MyHull", colorBlue,
----- Original Message -----
From: Bruce Hawkins
To: amibroker@xxxxxxxxxxxxxxx
Sent: Sunday, December 31, 2006 4:28 AM
Subject: Re: [amibroker] Hull Moving Averages
Try this:
function HullMaFunction( P, Periods, Delay )
{
X = 2 * WMA(P,round(Periods/2)) - WMA(P,Periods);
HullMA = WMA(X,round(sqrt(Periods)));
HullMA = Ref(HullMA,-Delay);
return HullMa;
}
PlotPriceField = ParamToggle("PriceField","HIDE|SHOW",1);
P = ParamField("Price field",-1);
Periods = Param("Periods", 15, 2, 200, 1, 10Delay = Param("Delay", 0, 0, 10, 1 );< /span>
HullMA = HullMaFunction( P, Periods, Delay );
if( PlotPriceField ) Plot(C,"",1,128);
Plot( HullMA, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );
ianjw2 wrote:
I've only just become aware of the Hull Moving Average.
It seems to be on top of the normal MA lag and manages to maintain nice
smoothing at the same time.
Has anyone done any AFL code for it and is willing to share?
MetaStock Formula
period:=Input("Period",1,200,20) ;
sqrtperiod:=Input("Square Root of Period",1,20,4);
Mov(2*(Mov(C,period/2,W))-Mov(C,period,W),sqrtperiod,W);
Above is the Metastock code, but I have no idea how to convert it.
ijw
------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.28/604 - Release Date: 12/26/2006
----------------------------------------------------------------------------
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.409 / Virus Database: 268.15.28/604 - Release Date: 12/26/2006
Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.16.1/611 - Release Date: 12/31/2006 12:47 PM
|