文華的MA和EMA分別對(duì)應(yīng)MC中的average和xaverage
?
文華中的sma是擴(kuò)展指數(shù)加權(quán)移動(dòng)平均函數(shù),代碼如下:
?
//sma
inputs:?
PriceValue( numericseries ),?
Len( numericsimple ) ,?
waite(numericsimple);? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
variables:?
var0( waite/ ( Len) ) ;
if CurrentBar = 1 then
sma = PriceValue
else
sma = sma[1] + var0 * ( PriceValue - sma[1] ) ;
?
文華的MA和EMA分別對(duì)應(yīng)MC中的average和xaverage
?
文華中的sma是擴(kuò)展指數(shù)加權(quán)移動(dòng)平均函數(shù),代碼如下:
?
//sma
inputs:?
PriceValue( numericseries ),?
Len( numericsimple ) ,?
waite(numericsimple);? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
variables:?
var0( waite/ ( Len) ) ;
if CurrentBar = 1 then
sma = PriceValue
else
sma = sma[1] + var0 * ( PriceValue - sma[1] ) ;