pine-scriptalgorithmic-trading

What is the equivalent of console.log in pine-script?


Is it possible to console.log variables, or the results of function invocation in pine-script? I'd like to convert a pine-script script into JavaScript, and I'd like to verify pinescript variables I'm moving into JavaScript are have the same value in the pinescript script v/s the JavaScript version. Any work arounds are welcome if this functionality does not exist. Thanks!


Solution

  • This answer is now outdated. Please consult other more recent answers.


    There is no way to print text or variables in pine-script to any form of "console". But you can use plot to print, very short text above or below each tick. The text, however, is static and you cannot use variables to change it.

    You can also use various tricks to show values in the very limited indicator fields (on top-left) of the chart window. Or move lines and plots out of visible are of chart, but still see the axis highlights.

    Please check their Wiki and consult the 1000's of other user's scripts to find out the details on how to do it.