pine-script

Pine script callback


Is it possible to use callbacks in Pine Script? Something like this:

//@version=5
indicator("Callback")
callackCaller(callback) =>
    callback(0)
callbackFunction(value) =>
    value

callbackCaller(callbackFunction)

plot(close)

Solution

  • No.

    There is no Function argument type in Pine so you cannot pass it as a function parameter.

    When thinking about Pine's capabilities, aim a bit below Turbo Pascal to minimize the number of wtf/min.