VolatilityVolatility - The amount of price deviation in the specified time interval.
The calculation is made from the opening point to the closing point, and the maximum and minimum deviation between them is also included. Any timeframes are supported.
Available information: the start date of the calculation (according to the time zone of the exchange), the current volatility from the initial opening point or from the last closing point, the total volatility for all periods.
An indicator of useful use in everyday work.
Thanks for your attention!
Information
Down since Initial PriceSimple indicator that just displays two labels. One at the lowest price with the percentage decrease since initial price and one at current price with the percentage change since initial price. Both labels can be toggled on/off in the settings.
Can be used to quickly analyze drops after IPO, for example if you have target percentage that the stock should drop after IPO.
Don't hesitate to send me a message if you have questions, noticed any bugs or have suggestions on improvements.
ProbabilityLibrary "Probability"
erf(value) Complementary error function
Parameters:
value : float, value to test.
Returns: float
ierf_mcgiles(value) Computes the inverse error function using the Mc Giles method, sacrifices accuracy for speed.
Parameters:
value : float, -1.0 >= _value >= 1.0 range, value to test.
Returns: float
ierf_double(value) computes the inverse error function using the Newton method with double refinement.
Parameters:
value : float, -1. > _value > 1. range, _value to test.
Returns: float
ierf(value) computes the inverse error function using the Newton method.
Parameters:
value : float, -1. > _value > 1. range, _value to test.
Returns: float
complement(probability) probability that the event will not occur.
Parameters:
probability : float, 0 >=_p >= 1, probability of event.
Returns: float
entropy_gini_impurity_single(probability) Gini Inbalance or Gini index for a given probability.
Parameters:
probability : float, 0>=x>=1, probability of event.
Returns: float
entropy_gini_impurity(events) Gini Inbalance or Gini index for a series of events.
Parameters:
events : float , 0>=x>=1, array with event probability's.
Returns: float
entropy_shannon_single(probability) Entropy information value of the probability of a single event.
Parameters:
probability : float, 0>=x>=1, probability value.
Returns: float, value as bits of information.
entropy_shannon(events) Entropy information value of a distribution of events.
Parameters:
events : float , 0>=x>=1, array with probability's.
Returns: float
inequality_chebyshev(n_stdeviations) Calculates Chebyshev Inequality.
Parameters:
n_stdeviations : float, positive over or equal to 1.0
Returns: float
inequality_chebyshev_distribution(mean, std) Calculates Chebyshev Inequality.
Parameters:
mean : float, mean of a distribution
std : float, standard deviation of a distribution
Returns: float
inequality_chebyshev_sample(data_sample) Calculates Chebyshev Inequality for a array of values.
Parameters:
data_sample : float , array of numbers.
Returns: float
intersection_of_independent_events(events) Probability that all arguments will happen when neither outcome
is affected by the other (accepts 1 or more arguments)
Parameters:
events : float , 0 >= _p >= 1, list of event probabilities.
Returns: float
union_of_independent_events(events) Probability that either one of the arguments will happen when neither outcome
is affected by the other (accepts 1 or more arguments)
Parameters:
events : float , 0 >= _p >= 1, list of event probabilities.
Returns: float
mass_function(sample, n_bins) Probabilities for each bin in the range of sample.
Parameters:
sample : float , samples to pool probabilities.
n_bins : int, number of bins to split the range
@return float
cumulative_distribution_function(mean, stdev, value) Use the CDF to determine the probability that a random observation
that is taken from the population will be less than or equal to a certain value.
Or returns the area of probability for a known value in a normal distribution.
Parameters:
mean : float, samples to pool probabilities.
stdev : float, number of bins to split the range
value : float, limit at which to stop.
Returns: float
transition_matrix(distribution) Transition matrix for the suplied distribution.
Parameters:
distribution : float , array with probability distribution. ex:.
Returns: float
diffusion_matrix(transition_matrix, dimension, target_step) Probability of reaching target_state at target_step after starting from start_state
Parameters:
transition_matrix : float , "pseudo2d" probability transition matrix.
dimension : int, size of the matrix dimension.
target_step : number of steps to find probability.
Returns: float
state_at_time(transition_matrix, dimension, start_state, target_state, target_step) Probability of reaching target_state at target_step after starting from start_state
Parameters:
transition_matrix : float , "pseudo2d" probability transition matrix.
dimension : int, size of the matrix dimension.
start_state : state at which to start.
target_state : state to find probability.
target_step : number of steps to find probability.
Intraday Bar's Prices Info* Intraday Bar's Prices Info display all prices type of a bar intraday and highlight Price Zone on Chart.
* These informations may useful for place Pending Order at exact price level.
* This simple script can show info of 2 bars at one time and setup as below:
1. GMT: default is GMT+7 and adjustable
2. Time setting: Date - Month - Year - Hours - Minutes - Seconds
3. Color setting: Can adjust color for each bar
Function - Shannon Entropyfunctions for shannon's entropy
reference:
- en.wiktionary.org
- machinelearningmastery.com
Ticker Info FYTicker Info for Companies FY
Currently including:
-> Market Cap
-> Enterprise Value
-> Total Shares Outstanding
-> Number of Employees
-> P/E Ratio
-> P/R Ratio
-> P/B Ratio
More information attributes for companies will be added as updates in the future.
Leave a like to keep this going!
Simple Candle Info This script shows the following simple information about the last candle:
- Candle size
- Body size included %
- Top Wick size
- Bottom Wick size
- Top Wick + Body size
- Bottom Wick + Body size
You can change:
- colors and position for labels
- add information for previous candle too
- change language
[Strategy] - EMA 10,20 59 with Profit DisplayedThis EA is still under construction !!
So for this EA is only based on the trend of the 3 EMA's
Buytrend = (ema1 and ema2 > ema3) and (ema1 and ema2 > ema3 )
We also change the Background depending on the trend.
bgcolor(Buytrend ? color.green : color.red,transp=70)
At this point I was wondering how much "profit" we would have made if this strategy was only based on the trend so I added the Labels to start/end close of that trend and then see how much profit in pip's we would have made.
Later I was wondering if I could get the total information on the trades and thats what the Label over the current candle is telling us. If that label is red we didn't made any profit and if its green we made som profit.
I also added a BuyProfit and a count buy/sells and a total Profit to see how that information clearly without opening the strategy tester.
NOTE this shows the profit in pip's
Next step is to implement a Buy/Sell Signal togheter with a Buy/SellSignalOUT signal.
Thats currently under development and you'll see some code being there already but as of now the orders are made from the trend signal not the Buy/Sell Signal.
Filter Information Box - PineCoders FAQWhen 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:
Lag
Smoothness via the Herfindahl index
Percentage Overshoot
Percentage Of Positive Weights
The script also attempts to determine the type of the analyzed filter, and will issue warnings when the filter shows signs of unwanted behavior.
DISPLAYED INFORMATION AND METHODS
The script displays one box on the chart containing two sections. The filter metrics section displays the following information:
- Lag : Measured in bars and calculated from the convolution between the filter's impulse response and a linearly increasing sequence of value 0,1,2,3... . This sequence resets when the impulse response crosses under/over 0.
- Herfindahl index : A measure of the filter's smoothness described by Valeriy Zakamulin. The Herfindahl index measures the concentration of the filter weights by summing the squared filter weights, with lower values suggesting a smoother filter. With normalized weights the minimum value of the Herfindahl index for low-pass filters is 1/N where N is the filter length.
- Percentage Overshoot : Defined as the maximum value of the filter step response, minus 1 multiplied by 100. Larger values suggest higher overshoots.
- Percentage Positive Weights : Percentage of filter weights greater than 0.
Each of these calculations is based on the filter's impulse response, with the impulse position controlled by the Impulse Position setting (its default is 1000). Make sure the number of inputs the filter uses is smaller than Impulse Position and that the number of bars on the chart is also greater than Impulse Position . In order for these metrics to be as accurate as possible, make sure the filter weights add up to 1 for low-pass and band-stop filters, and 0 for high-pass and band-pass filters.
The comments section displays information related to the type of filter analyzed. The detection algorithm is based on the metrics described above. The script can detect the following type of filters:
All-Pass
Low-Pass
High-Pass
Band-Pass
Band-Stop
It is assumed that the user is analyzing one of these types of filters. The comments box also displays various warnings. For example, a warning will be displayed when a low-pass/band-stop filter has a non-unity pass-band, and another is displayed if the filter overshoot is considered too important.
HOW TO SET THE SCRIPT UP
In order to use this script, the user must first enter the filter settings in the section provided for this purpose in the top section of the script. The filter to be analyzed must then be entered into the:
f(input)
function, where `input` is the filter's input source. By default, this function is a simple moving average of period length . Be sure to remove it.
If, for example, we wanted to analyze a Blackman filter, we would enter the following:
f(input)=>
pi = 3.14159,sum = 0.,sumw = 0.
for i = 0 to length-1
k = i/length
w = 0.42 - 0.5 * cos(2 * pi * k) + 0.08 * cos(4 * pi * k)
sumw := sumw + w
sum := sum + w*input
sum/sumw
EXAMPLES
In this section we will look at the information given by the script using various filters. The first filter we will showcase is the linearly weighted moving average (WMA) of period 9.
As we can see, its lag is 2.6667, which is indeed correct as the closed form of the lag of the WMA is equal to (period-1)/3 , which for period 9 gives (9-1)/3 which is approximately equal to 2.6667. The WMA does not have overshoots, this is shown by the the percentage overshoot value being equal to 0%. Finally, the percentage of positive weights is 100%, as the WMA does not possess negative weights.
Lets now analyze the Hull moving average of period 9. This moving average aims to provide a low-lag response.
Here we can see how the lag is way lower than that of the WMA. We can also see that the Herfindahl index is higher which indicates the WMA is smoother than the HMA. In order to reduce lag the HMA use negative weights, here 55% (as there are 45% of positive ones). The use of negative weights creates overshoots, we can see with the percentage overshoot being 26.6667%.
The WMA and HMA are both low-pass filters. In both cases the script correctly detected this information. Let's now analyze a simple high-pass filter, calculated as follows:
input - sma(input,length)
Most weights of a high-pass filters are negative, which is why the lag value is negative. This would suggest the indicator is able to predict future input values, which of course is not possible. In the case of high-pass filters, the Herfindahl index is greater than 0.5 and converges toward 1, with higher values of length . The comment box correctly detected the type of filter we were using.
Let's now test the script using the simple center of gravity bandpass filter calculated as follows:
wma(input,length) - sma(input,length)
The script correctly detected the type of filter we are using. Another type of filter that the script can detect is band-stop filters. A simple band-stop filter can be made as follows:
input - (wma(input,length) - sma(input,length))
The script correctly detect the type of filter. Like high-pass filters the Herfindahl index is greater than 0.5 and converges toward 1, with greater values of length . Finally the script can detect all-pass filters, which are filters that do not change the frequency content of the input.
WARNING COMMENTS
The script can give warning when certain filter characteristics are detected. One of them is non-unity pass-band for low-pass filters. This warning comment is displayed when the weights of the filter do not add up to 1. As an example, let's use the following function as a filter:
sum(input,length)
Here the filter pass-band has non unity, and the sum of the weights is equal to length . Therefore the script would display the following comments:
We can also see how the metrics go wild (note that no filter type is detected, as the detected filter could be of the wrong type). The comment mentioning the detection of high overshoot appears when the percentage overshoot is greater than 50%. For example if we use the following filter:
5*wma(input,length) - 4*sma(input,length)
The script would display the following comment:
We can indeed see high overshoots from the filter:
@alexgrover for PineCoders
Look first. Then leap.
Bitcoin Prices InfoPanelHello traders
This script is based on the great Ricardo Santos InfoPanel script
It will display all the Bitcoin prices
The script is public so you can adjust according to your own needs
PS
You might have to scroll right on your chart to see the panel
Enjoy :)
Dave
Multi Bar OHLC Compare Panel (Floating Grid)Multi Bar OHLC Compare Panel by RagingRocketBull 2019
version 1.0
This indicator lets you compare OHLCV values from several specified bars. Bars can be dynamic/persistent.
You can also use it as an alternate OHLC panel if you don't like small font of the native TradingView panel.
It uses Pinescript v4 to output data dynamically as string labels in a horiz/vertical grid.
Features:
- Floating Panel with customizable horiz/vertical layout and grid spacing
- Support for up to 5 OHLC bars (highlighted with markers)
- Outputs Bar #/index, OHLCV, Bar Change Value/%, Exchange/Ticker, Timeframe, Timestamp strings
- Dynamic (fixed offset)/Persistent bars (fixed time)
- Show/Hide parts of strings
- Full output string customization, including text size, date/time format and delimiters
- 2 Anchor points for panel offset: cur bar high or range high
- Bar Change can change color
Usage:
- specify at least 1 bar index as OHLC source
- select anchor point to position the panel
- select horiz/vertical grid layout
- adjust horiz/vertical spacing
- customize output strings as needed
Notes:
- this indicator uses Pinescript v3 Compatibity Framework
- both bars 1,2 are required for log scale adjustment to work
- you can't attach the panel to screen's top/bottom and must use offset/anchor because, unlike plotshape, string labels don't support yloc=yloc.top/bottom, only yloc.above/belowbar
- you can't precisely align strings in a grid because there's no label.get_width/height to calculate mid/left points, only get_x/y/text. Alignment will break depending on string length, zoom and change color option on/off
- bar change is rendered as a separate label when change color is enabled (2 panels total) and merged into the main panel when disabled (single panel)
- you can't change the order of strings as playing with the natural order of things isn't the best of ideas
- you can modify the script to compare up to 50 OHLC bars, but do you need that much power? Of course, you do.
- you can't set color/style for string labels in Style UI, so a few extra settings were added.
- bar index is limited to 5000 for free accounts (10000 for paid), will show an error when exceeded, also when it exceeds the total number of bars in history
- in persistent bars mode all bars with index > 0 are considered persistent, bar 0 always remains a dynamic bar
- persistent bars' offset is reset: in replay mode on exit or when price reaches cur bar, or when panel layout is changed from h to v in both replay/realtime modes
- initial pos of each persistent bar relative to the first realtime bar anchor doesn't change during session - new persistent bars introduced during session are attached to the most recent cur bar anchor
P.S. Everything is proceeding as I have foreseen