admin管理员组

文章数量:1296254

I have a library function which requires a "simple int" input. In creating a new UDT I find that the fields only produce "series int" inputs for this function.

Here is a short example:

//@version=6
indicator("My script")

// Function that requires a "simple int" input:
square( simple int n ) => n*n

// UDT "Test" with one "int" field:
type Test
    int Field1

// New "Test" declared as "A" with Field1 = 8:
var A = Test.new( Field1 = 8 )

// Error reports A.Field1 is "series int"!
plot( square( A.Field1 ) )
//            ^^^^^^^^
//           "series int" when "simple int" is expected

// Question:  Where in the above code should "A" or "A.Field1" be declared "simple"?

本文标签: pine scriptWhere to declare a variable quotsimplequot when adding a UDTStack Overflow