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...
Library "FunctionPeakDetection" Method used for peak detection, similar to MATLAB peakdet method function(sample_x, sample_y, delta) Method for detecting peaks. Parameters: sample_x : float array, sample with indices. sample_y : float array, sample with data. delta : float, positive threshold value for detecting a peak. Returns: tuple with...
Library "Averages" Contains utilities for generating averages from arrays. Useful for manipulated or cleaned data. triangular(src, startingWeight) Calculates the triangular weighted average of a set of values where the last value has the highest weight. Parameters: src : The array to derive the average from. startingWeight : The weight to begin...
Library "_arrayutils" Library contains utility functions using arrays. delete(arr, index) remove an item from array at specific index. Also deletes the item Parameters: arr : - array from which the item needs to be deleted index : - index of item to be deleted Returns: void pop(arr) remove the last item from array. Also deletes the...
Library "Signal_Data_2021_09_09__2021_11_18" Functions to support my timing signals system import_start_time(harmonic) get the start time for each harmonic signal Parameters: harmonic : is an integer identifying the harmonic Returns: the starting timestamp of the harmonic data import_signal(index, harmonic) access point for pre-processed data...
Library "FunctionArrayMaxSubKadanesAlgorithm" Implements Kadane's maximum sum sub array algorithm. size(samples) Kadanes algorithm. Parameters: samples : float array, sample data values. Returns: float. indices(samples) Kadane's algorithm with indices. Parameters: samples : float array, sample data values. Returns: tuple with format .
Library "cache" 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...
Library "ArrayMultipleDimensionPrototype" A prototype library for Multiple Dimensional array methods index_md_to_1d() new_float(dimensions, initial_size) Creates a variable size multiple dimension array. Parameters: dimensions : int array, dimensions of array. initial_size : float, default=na, initial value of the array. Returns: float...
Library "FunctionArrayReduce" A limited method to reduce a array using a mathematical formula. float_(formula, samples, arguments, initial_value) Method to reduce a array using a mathematical formula. Parameters: formula : string, the mathematical formula, accepts some default name codes (index, output, previous, current, integer index of arguments...
Library "FunctionProbabilityDistributionSampling" Methods for probability distribution sampling selection. sample(probabilities) Computes a random selected index from a probability distribution. Parameters: probabilities : float array, probabilities of sample. Returns: int.
Library "FunctionElementsInArray" Methods to count number of elements in arrays count_float(sample, value) Counts the number of elements equal to provided value in array. Parameters: sample : float array, sample data to process. value : float value to check for equality. Returns: int. count_int(sample, value) Counts the number of elements...
Library "amibroker" This library consists of functions from amibroker that doesn't exist on tradingview pinescript. The example of these are the ExRem and Flip. In the example below, I used ExRem to remove the excessive buy and sell signals. Meanwhile, I used the Flip to highlight the bg color when there is an open position. exrem(series1, series2) Removes...
Library "FunctionCompoundInterest" Method for compound interest. simple_compound(principal, rate, duration) Computes compound interest for given duration. Parameters: principal : float, the principal or starting value. rate : float, the rate of interest. duration : float, the period of growth. Returns: float. variable_compound(principal,...
Library "FunctionSMCMC" Methods to implement Markov Chain Monte Carlo Simulation (MCMC) markov_chain(weights, actions, target_path, position, last_value) a basic implementation of the markov chain algorithm Parameters: weights : float array, weights of the Markov Chain. actions : float array, actions of the Markov Chain. target_path : float...
Library "FunctionGeometricLineDrawings" array_delete_all_lines(lines) deletes all lines in array. Parameters: lines : line array, array with line objects to delete. Returns: void. triangle(sample_x, sample_y, xloc, extend, color, style, width) Draw a Triangle with 3 vector2D(x, y) coordinates. Parameters: sample_x : int array, triangle...
This is same as existing zigzag library with respect to functionality. But, there is a small update with respect to how arrays are used internally. This also leads to issues with backward compatibility. Hence I decided to make this as new library instead of updating the older one. Below are the major changes: Earlier version uses array.unshift for adding...
This is a public library that include the functions explained below. The libraries are considered public domain code and permission is not required from the author if you reuse these functions in your open-source scripts