//@version=1
Params
Numeric Length(26); // HMA计算周期
Numeric LineWidth(1); // 线宽
Numeric LineColor(16711680); // 蓝色RGB值(0,0,255)
Vars
NumericSeries WMA1; // 第一层WMA
NumericSeries WMA2; // 第二层WMA
NumericSeries Diff; // 差值序列
NumericSeries HMA; // Hull移动平均线
Begin
// 计算第一层WMA(周期为N/2)
WMA1 = 2 * WMA(Close, Round(Length/2, 0));
// 计算第二层WMA(周期为N)
WMA2 = WMA(Close, Length);
// 计算差值
Diff = WMA1 - WMA2;
// 计算最终HMA(周期为sqrt(N))
HMA = WMA(Diff, Round(SquareRoot(Length), 0));
// 绘制Hull移动平均线
PlotNumeric("HullMA", HMA, LineColor, LineWidth);
// 返回计算结果
Return HMA;
End
你这个像用户函数
而且WMA不是函数
是不是用AI写的