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, 10 );
Delay = Param("Delay", 0, 0, 10, 1 );
HullMA = HullMaFunction( P, Periods, Delay );
if( PlotPriceField ) Plot(C,"",1,128);
Plot( HullMA, _DEFAULT_NAME(), ParamColor( "Color", colorCycle ),
ParamStyle("Style") );