简体   繁体   English

Pinescript: function 内的 Function

[英]Pinescript: Function inside a function

I am trying create three functions inside a main function but am getting syntax error in input in the lines where I am defining these functions.我正在尝试在主 function 中创建三个函数,但在定义这些函数的行中输入语法错误。

customFunc() => 
////////
data(x, id) => security(id, mtf_val!="" ? mtf_val : timeframe.period, x)
    getLow(x, y, z, a, id) => 
       ll = y
       v = data(x, id)
       m = v==ll or data(z, id) - v > a*syminfo.mintick
       if v!=ll
           ll := v
       if m
           v := 0.0
       [v,ll]
    getHigh(x, y, z, a, id) => 
       lh = y
       v = data(x, id)
       m = v==lh or v - data(z, id) > a*syminfo.mintick
       if v!=lh
          lh := v
       if m
          v := 0.0
       [v,lh]

Getting syntax error in the 3rd, 4th and 13th line.在第 3、4 和 13 行出现语法错误。 Where am I going wrong?我哪里错了?

Pine does not support sub-functions being defined within other functions. Pine 不支持在其他函数中定义子函数。
All functions must be defined separately in the global scope.所有功能必须在全局 scope 中单独定义。
See Declaring Functions in the user manual.请参阅用户手册中的声明函数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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