Currently in PineScript you cannot modify global variables in functions because of scope limitations.
One way to work around that is to use arrays.
This Library simplifies the use of arrays as global variables to make your code look cleaner.
If you're coming from other programming languages, I'm sure you will come across this issue in your PineScript journey at...
This is a logging library for Pinescript. It is aimed to help developers testing and debugging scripts with a simple to use logger function.
Pinescript lacks a native logging implementation. This library would be helpful to mitigate this insufficiency.
This library uses table to print outputs into its view. It is simple, customizable and...
A simple banchmark library to analyse script performance and bottlenecks.
Very useful if you are developing an overly complex application in Pine Script, or trying to optimise a library / function / algorithm...
Supports artificial looping benchmarks (of fast functions)
Supports integrated linear benchmarks (of expensive scripts)
I'm building quite a lot of pretty complicated indicators/strategies in Pine Script. Quite often they don't work from the 1 try so I have to debug them heavily.
In Pine Script there are no fancy debuggers so you have to be creative. You can plot values on your screens, check them in the data window, etc.
If you want to display some textual information, you can...
Simple method I used to debug problem in my script.
For loop generates 5 numbers from the given depth. At present, depth is 9
Rules for generating the combinations are as follows:
First number is always 1
Two even numbers should not be adjacent to each other and two odd numbers should not be adjacent to each other
Numbers should be ordered in...
Methods for debuging/output into a table, console like style.
init(size) initiate property variables.
size : int, console line size.
Returns: tuple, table and string array.
queue(console_id, new_line) Regular Queue, will be called once every bar its called.
console_id : string array, console...
Provides functions to time the execution of a script.
When timing scripts, keep in mind that the runtime environment is fluid on TradingView. Different servers or server loads will impact execution time.
stopwatchStats() Times the execution of a script.
Returns: A tuple of four values: timePerBarInMs, totalTimeInMs, barsTimed,...
Logging library for easily displaying debug, info, warn, error and critical messages.
No real need to explain why you might want to use this library! I'm sure you've all experienced the frustration of trying to understand the data state of your scripts... so, enjoy! More on it's way...
(Don't forget to check the helpers in the script and the...
DEBUGGER is a library to help print debug messages to a console.
This library provides an easy-to-use interface to print your debugging messages to a console in the chart. Special attention has been given to printing series and arrays easily.
A debugger is a valuable tool when working on scripts and getting into trouble. Unfortunately, TradingView does not...
A simple cache library to store key value pairs.
Fed up of injecting and returning so many values all the time?
Want to separate your code and keep it clean?
Need to make an expensive calculation and use the results in numerous places?
Want to throttle calculations or persist random values across bars or ticks?
Then you've come to...
Provides a framework for logging debug information to a window on the chart.
consoleWrite(txt, maxLines) Adds a line of text to the debug window. The text is rolled off the bottom of the window as it fills up.
txt : - this is the text to be appended to the window
maxLines : - this is the size of the...
Thange Vault is a collection of utility functions required by the Thange Woodwind Playbook.
debug(msg) Print debug information
msg : message to be logged on console
tickFormat() Create a string template to restrict stop-loss, take-profit level precision to ticks.
Returns: A string format template
A Library to log and display messages in a table, with different colours.
The log consists of 3 columns:
Bar Index / Message / Log
QuantNomad - for his idea on logging messages as Error/Warnings and displaying the color based on the type of the message
setHeader(_t, _location, _header1, _header2, _header3, _halign, _valign, _size) Sets...
Production ready assertions and auto-reporting for unit testing pine scripts.
This library was born from the need to maintain production level stability and catch regressions / bugs early and fast. I hope this help you trust your pine scripts too. More libraries and tools on their way... please follow for more.
Please see the script for...
This is the same RSI7 used inside the 3cBot+ backtesting engine.
Use this code as example to develop your buy/sell signal indicators
and interface it to the backtesting engine.
Calculating buy/sell signals.
signal(RSI7_OverSold) Calculates buy/sell signals.
RSI7_OverSold : (default value 20) and RSI7_OverBought...