Function
Function - Forecast LinearFunction to calculate a forecast using a linear regression approach, this is the same function used on excel and other data sheet programs.
reference:
- support.microsoft.com
- stackoverflow.com
Function - Sequence From SeriesFunction to create a array from a sample taken from a series (ex:. close, hlc3...).
Function - Probability Chebyshev Inequalityfunction to calculate Chebyshev Inequality. wich can be used to compute the probability that we will diverge from what we expect to obtain.
reference:
- www.omnicalculator.com
- github.com
- statisticstopics.wordpress.com
- en.wikipedia.org
Function - Entropy Gini Indexfunction to retrieve Gini Impurity / Gini Index.
reference:
- victorzhou.com
- en.wikipedia.org
Function - Shannon Entropyfunctions for shannon's entropy
reference:
- en.wiktionary.org
- machinelearningmastery.com
test - event distributiondisplays the distribution of the outcome of a event over the last event.
similar to this script:
To Integer FunctionCustom toInteger() function accepts and truncates the following forms: const, input, simple, and series of the following types: float, integer, and string.
Special thanks and credit to BeeHolder for idea on using str.format("{0}", string) as workaround for accepting and handling string types!
NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!
Product function for ArraysHello,
This code may be useful for Pine script coders only.
Arrays were welcomed in Pine script, as they are a foundation for coding properly many useful things, like studies and strategies here in TradingView :)
TradingView recently released new functions for arrays, like array.median and more, but the "PRODUCT" function was still missing, so I created it. I've no doubt that array.product() will soon be proposed by the platform, but for the time being, one can use mine.
It does the same thing as the PRODUCT() function in Excel : it multiplies all the source values included in the specified lookback, and returns the product. This function can accept Series or Arrays as source input.
Unicode Font Function V2 - JDThis script is a continuation from Duyck's Unicode font function
A different approach made on this function to able change font type on a single string
Now you can call it as a function to change the font type on every string that you need,
either it is for a Label or regular Text
Shoutout to @Duyck for his amazing works on this function.
Thank you to PineScript Community as well
Let me know if you guys have any suggestion or idea.
Greets,
dddfault
Function Square WaveThis is a script to draw a square wave on the chart, with an indicator for current price.
Markets undergoing Dow Jones or Wyckoff Accumulation/Distribution cycles tend to move in such waves, and if the period of the cycles are detected, a signal for accumulation/distribution phases can be created as an early warning.
Useful inputs:
- Average True Range as the wave height.
- Assumed Wave period as the wave duration.
I divided the current price wave by 2 to make the indicator more visually friendly.
GLHF
- DPT
Function Sawtooth WaveThis is an indicator to draw a sawtooth wave on the chart.
It can be a useful perspective, as decaying markets tend to oscillate in reverse sawtooth waves, and bullish markets can oscillate in conventional sawtooth waves. With the right inputs, it can be an early warning signal for potential movements.
Something I've noted is that large waves cause a ripple effect and sets the frequency for the market until a change occurs. Sawtooth waves may help in capturing ripple waves.
Useful inputs are:
- Average True Range as wave height (amplitude)
- Periodicity of market as wave duration (frequency)
(Inputs will change the wave from conventional to reverse)
I hope that it is helpful.
GLHF
- DPT
Function Cosine WaveI didn't see a public script for drawing a cosine wave on the chart, with slight changes to RicardoSantos' Function Sine Wave Indicator, so I published this as my first script.
I hope that is useful.
Function - Kernel Density Estimation (KDE)"In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function of a random variable."
from wikipedia.com
KDE function with optional kernel:
Uniform
Triangle
Epanechnikov
Quartic
Triweight
Gaussian
Cosinus
Republishing due to change of function.
deprecated script: