简体   繁体   中英

Why does PineScript tells me that my TEMA is not a function?

I'm trying to apply the Triple Moving Average to CCI, but I get the error "tema is not a function". Could someone help me? Thank you very much. Here is my code:

    //@version=4

study("my Script",overlay=false)

//Input
Temalength = input(30, title="Tema Length")

src=close

EMA1= ema(src, Temalength)
EMA2 = ema(EMA1, Temalength)
EMA3 = ema(EMA2, Temalength)
tema = (3*EMA1)-(3*EMA2)+EMA3


//CCI
CCI = cci(src, 10)
emaCCI = tema(CCI, 20)

plot(emaCCI, title="TemaCCI", linewidth=2)

Solved

tema (x, y) => 
    EMA1 = ema(x, y)
    EMA2 = ema(EMA1, y)
    EMA3 = ema(EMA2, y)
    (3*EMA1)-(3*EMA2)+EMA3

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM