Library "FunctionCosineSimilarity" Cosine Similarity method. function(sample_a, sample_b) Measure the similarity of 2 vectors. Parameters: sample_a : float array, values. sample_b : float array, values. Returns: float. diss(cosim) Dissimilarity helper function. Parameters: cosim : float, cosine similarity value (0 > 1) Returns: float
Library "ArrayOperations" Array element wise basic operations. add(sample_a, sample_b) Adds sample_b to sample_a and returns a new array. Parameters: sample_a : values to be added to. sample_b : values to add. Returns: array with added results. - sample_a provides type format for output. - arrays do not need to be symmetric. - sample_a must...
Library "WIPNNetwork" this is a work in progress (WIP) and prone to have some errors, so use at your own risk... let me know if you find any issues.. Method for a generalized Neural Network. network(x) Generalized Neural Network Method. Parameters: x : TODO: add parameter x description here Returns: TODO: add what function returns
Library "FunctionPatternDecomposition" Methods for decomposing price into common grid/matrix patterns. series_to_array(source, length) Helper for converting series to array. Parameters: source : float, data series. length : int, size. Returns: float array. smooth_data_2d(data, rate) Smooth data sample into 2d points. Parameters: data...
Library "FunctionBlackScholes" Some methods for the Black Scholes Options Model, which demonstrates several approaches to the valuation of a European call. // reference: // people.math.sc.edu // people.math.sc.edu asset_path(s0, mu, sigma, t1, n) Simulates the behavior of an asset price over time. Parameters: s0 : float, asset price at...
Library "ArrayExt" Array extensions get(a, idx) Get element from the array at index, or na if index not found Parameters: a : The array idx : The array index to get Returns: The array item if exists or na get(a, idx) Get element from the array at index, or na if index not found Parameters: a : The array idx : The array index to...
Library "FunctionMinkowskiDistance" Method for Minkowski Distance, The Minkowski distance or Minkowski metric is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance. It is named after the German mathematician Hermann Minkowski. reference: en.wikipedia.org double(point_ax,...
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...
Library "FunctionGenerateRandomPointsInShape" Generate random vector points in geometric shape (parallelogram, triangle) random_parallelogram(vector_a, vector_b) Generate random vector point in a parallelogram shape. Parameters: vector_a : float array, vector of (x, y) shape. vector_b : float array, vector of (x, y) shape. Returns: float array,...
Library "FunctionArrayNextPrevious" Methods to iterate through a array by a fixed anchor point. array_next(array, start_index) retrieves the next value of the internal pointer index. Parameters: array : (any array type), array to iterate. start_index : int, anchor index to start indexing. array_previous(array, start_index) retrieves the...
Library "FunctionNNLayer" Generalized Neural Network Layer method. function(inputs, weights, n_nodes, activation_function, bias, alpha, scale) Generalized Layer. Parameters: inputs : float array, input values. weights : float array, weight values. n_nodes : int, number of nodes in layer. activation_function : string, default='sigmoid',...
Library "FunctionNNPerceptron" Perceptron Function for Neural networks. function(inputs, weights, bias, activation_function, alpha, scale) generalized perceptron node for Neural Networks. Parameters: inputs : float array, the inputs of the perceptron. weights : float array, the weights for inputs. bias : float, default=1.0, the default bias...
Library "MLActivationFunctions" Activation functions for Neural networks. binary_step(value) Basic threshold output classifier to activate/deactivate neuron. Parameters: value : float, value to process. Returns: float linear(value) Input is the same as output. Parameters: value : float, value to process. Returns: float sigmoid(value) ...
Library "MLLossFunctions" Methods for Loss functions. mse(expects, predicts) Mean Squared Error (MSE) " MSE = 1/N * sum ((y - y')^2) ". Parameters: expects : float array, expected values. predicts : float array, prediction values. Returns: float binary_cross_entropy(expects, predicts) Binary Cross-Entropy Loss (log). Parameters: ...
Library "Points" Provides functions for simplifying operations with collections of x+y coordinates. Where x is typically a bar index or time (millisecond) value. new(size) Creates two arrays. One for X (int ) and another for Y (float ). Parameters: size : The initial size of the arrays. size(xA, yA) Checks the size of the arrays and if they're...
Library "eHarmonicpatterns" Library provides an alternative method to scan harmonic patterns. This is helpful in reducing iterations scan_xab(bcdRatio, err_min, err_max, patternArray) Checks if bcd ratio is in range of any harmonic pattern Parameters: bcdRatio : AB/XA ratio err_min : minimum error threshold err_max : maximum error...
A simple hashmap implementation for pinescript. It gets your string array and transforms it into a hashmap. Before using it you need to initialize your array with the size you need for your specific case since the size is not dynamic. To use it, first you need to import it the following way: > import marspumpkin/hashmaps/1 Then, initialize your array with the...
This Library is aimed to mitigate the limitation of Pinescript having only one structured data type which is only arrays. It lacks data types like Dictionaries(in Python) or Object (in JS) that are standard for other languages. Tuples do exist, but it hardly solves any problem. Working only with Arrays could be overwhelming if your codebase is large. I looked for...