翻看了XAverage的源码:
Params
Numeric Price(10); //数值型序列值
Numeric Length(10); //周期数
Vars
Numeric sFcactor;
Series<Numeric> XAvgValue;
Begin
sFcactor = 2 / ( Length + 1 );
if (CurrentBar == 0 )
{
XAvgValue = Price;
}else
{
XAvgValue = XAvgValue[1] + sFcactor * ( Price - XAvgValue[1] ) ;
}
Return XAvgValue;
End
问题如下:
1.求老师告知, XAvgValue = XAvgValue[1] + sFcactor * ( Price - XAvgValue[1] )这段应该怎么理解?
2.XAvgValue 和 Average 有啥区别?
3.XAverage(TrueRange,ATRLength)与 AvgTrueRange(Numeric Length) 有什么区别?
xaverage就是平时讲的ema