公式編譯一直提示錯誤是怎么回事?
作者:開拓者 TB 來源:cxh99.com 發布時間:2016年02月22日
- 咨詢內容:
為什么我新建一個公示應用,直接復制了“求卡夫曼自適應移動平均”的公式,編譯就是通不過呢?一直提示參數聲明的數據類型錯誤,一個東西都沒有改動呀。
Params
NumericSeries Price(1);
Numeric EffRatioLength(10);
Numeric FastAvgLength(2);
Numeric SlowAvgLength(30);
Vars
Numeric NetChg(0);
Numeric TotChg(0);
Numeric EffRatio(0);
Numeric ScaledSFSqr(0);
NumericSeries AMAValue;
Numeric SFDiff;
Begin
if(CurrentBar == 0)
{
AMAValue = Price;
}Else
{
NetChg = Abs( Price - Price[EffRatioLength] );
TotChg = Summation( Abs( Price - Price[1] ), EffRatioLength );
EffRatio = IIF(TotChg > 0, NetChg / TotChg, 0);
SFDiff = 2 / ( FastAvgLength + 1 ) - 2 / ( SlowAvgLength + 1 );
ScaledSFSqr = Sqr( 2 / ( SlowAvgLength + 1 ) + EffRatio * SFDiff );
AMAValue = AMAValue[1] + ScaledSFSqr * ( Price - AMAValue[1] );
}
Return AMAValue;
End
- TB技術人員:
我知道原因了,原來是函數只能用函數,不能在公式應用中調用