█ OVERVIEW This script provides string manipulation functions to help Pine coders. █ FUNCTIONS PROVIDED f_strLeft(_str, _n) Function returning the leftmost `_n` characters in `_str`. f_strRight(_str, _n) Function returning the rightmost `_n` characters in `_str`. f_strMid(_str, _from,...
█ OVERVIEW This script presents a new function to help coders use security() in both repainting and non-repainting modes. We revisit this often misunderstood and misused function, and explain its behavior in different contexts, in the hope of dispelling some of the coder lure surrounding it. The function is incredibly powerful, yet misused, it can become a...
The PineCoders Backtesting and Trading Engine is a sophisticated framework with hybrid code that can run as a study to generate alerts for automated or discretionary trading while simultaneously providing backtest results. It can also easily be converted to a TradingView strategy in order to run TV backtesting. The Engine comes with many built-in strats for...
Our MTF Selection Framework allows Pine coders to add multi-timeframe capabilities to their script with the following features: ► Timeframe selection The higher timeframe can be selected using 3 different ways: • By steps (60 min., 1D, 3D, 1W, 1M, 1Y). • As a multiple of the current chart's resolution, which can be fractional, so 3.5 will work. • Fixed. ►...
This script provides a framework to add alerts to a script. It uses a method and provides code that: — Allows the indicator's users to select the plotting of markers representing the different conditions used to trigger alerts. — Allows filtering of the markers on direction: both, longs only, shorts only. — Uses a single alert for the indicator. It will trigger...
█ OVERVIEW The new varip keyword in Pine can be used to declare variables that escape the rollback process, which is explained in the Pine User Manual's page on the execution model . This publication explains how Pine coders can use variables declared with varip to implement logic that was impossible to code in Pine before, such as timing events during the...
Over the years, many FIR filters have been proposed by the Pine community, with the standard way of computing them being `for` loops. The arrival of arrays allows for a new, more efficient way to compute them. This script provides a template showing how you can compute FIR filters using Pine arrays. FIR Filters FIR stands for "Finite Impulse Response", and...
Much confusion exists in the TradingView community about backtesting on non-standard charts. This script tries to shed some light on the subject in the hope that traders make better use of those chart types. Non-standard charts are: Heikin Ashi (HA) Renko Kagi Point & Figure Range These chart types are called non-standard because they all transform market...
█ OVERVIEW After reading all the new names and renames that Pine Script V5 brought to us, I knew that my old Notepad++ User Defined Language (UDL) would need a big update, so I decided to do a complete remake using the same Dark color scheme theme of the Pine Editor. Then, I create a Notepad++ Theme and the Auto-Completion file with the Parameter hints for...
This is a companion script to the PineCoders Backtesting-Trading Engine. It illustrates how to build a signal plot in another script, which can in turn be fed in the Engine to provide entry, exit, filter and stop information. Connection to the Engine is done through its “External Indicator” input field at the very bottom of the Engine’s Settings/Inputs. The...
Even when your code does not use security() calls, repainting dynamics still come into play in the realtime bar. Script coders and users must understand them and, if they choose to avoid repainting, need to know how to do so. This script demonstrates three methods to avoid repainting when NOT using the security() function. Note that repainting dynamics when ...
This framework allows Pine coders to quickly build a complete multi-timeframe oscillator from any calculation producing values around a centerline, whether the values are bounded or not. Insert your calculation in the script and you have a ready-to-publish MTF Oscillator offering a plethora of presentation options and features. █ HOW TO USE THE FRAMEWORK 1 —...
Visual RSI offers a different way of looking at RSI by providing a composite representation of 9 different RSI-generated components. Instead of focusing on one line only, this approach blends multiple sources to provide the viewer with a larger context RSI-based picture. For those who don’t want to read • Green in bullish (>50) zone is the most bullish. • Red...
█ OVERVIEW Calculating time-based offsets is necessary when coders need to draw lines or labels into the future because using `xloc = xloc.bar_time` in `label.new()` or `line.new()` is then mandatory. This script provides a function to help with those calculations: f_timeFrom(_from, _qty, _units) The function calculates a negative (into the past) or...
This script calculates the run time of a Pine script. While its numbers are not very precise and it doesn’t work on all scripts, it will help developers calculate run times more precisely than by hand, and so provides Pine coders with an additional profiling tool to help them optimize their code. How to use the code • Place the code included between the...
Greetings Colleagues Following some recommendations and ideas I share this moving average, put all of them together The length calculation is automatic there is only one input. The length is inverse so it will wrap from the longest reference point, hence using phi Moving averages will wrap around the price. I've also added gradient color to plots and fill...
The need to calculate averages (arithmetic mean) comes up here and there in scripts. When you want the average of a value only when a given condition has occurred, you will often not be able to use the standard sma function in Pine because it will average all values in the series. Even if you take care to use your condition to set non-conforming values to zero,...
This script prints a trade number <1000 on the chart. It requires at least 3 bars between successive entries.