A collection of custom tools & utility functions commonly used with my scripts.
getDecimals() Calculates how many decimals are on the quote price of the current market
Returns: The current decimal places on the market quote price
truncate(float, float) Truncates (cuts) excess decimal places
float : _number The...
This is a simple utility which counts the number of bars and time elapsed after starting the script. This can be used in time or bars based conditions to modify script behavior.
This particular script does the following:
Starts timer when script is added to chart
Timer is green when starting and continues to be in green if the right Auth key is used in...
An utility function to parse session inputs. Extracts hours, minutes and weekdays (if defined) and returns a tuple as the result.
_parseSession(sessionString) => (hourStart, minuteStart, hourEnd, minuteEnd, weekdaysArray)
Examples presented on the chart.
When designing filters it can be interesting to have information about their characteristics, which can be obtained from the set of filter coefficients (weights). The following script analyzes the impulse response of a filter in order to return the following information:
Smoothness via the Herfindahl index
Percentage Of Positive...
Bands and trailing stops are important indicators in technical analysis, while we could think that both are different they can be in fact closely related, at least in the way they are made. Bands and trailing stops can be made from a simple central tendency estimator, like a moving average, and from a volatility estimator like standard deviation,...
Based on Sort pseudo-array v2 by apozdnyakov
- fixed issue where if the same number is repeated in the list it gets skipped
- replaced hardcoded 10000 and -10000 values with na in case those values are in the list
- added sort_all to demonstrate how to sort a list if the length is fixed
This simple script checks for data gaps in an intra-day TradingView chart. I have found that BitMEX 1-minute data is coming in rather holey lately, so I wrote this just to see how prevalent the problem is. It should work on any intra-day timeframe, not just 1-minute.
V1: initial release.
3 Moving Average Lines. All parameters are configurable via user input.
Each of these moving average lines already exist as individual indicators in TradingView. This script just bundles them for one stop shopping. It's helpful if you're limited by the number of indicators per chart. And highly educational: quickly compare the different averaging methods!