Math RoundHello Reader,
This is Observer from Vietnam.
PURPOSE
I'd like to share my script for Round Math, it's for only education purpose.
I make the formula math_row(x, y) to round the value as we design and shorten the number appearance (value). It's more flexible than str.tostring(close,format.volume) or others.
HOW TO USE
Formula math_row(x,y)
- x is the value which need to be rounded or shorten
- y is the number which you want to round after "." symbol.
***Shorten***
If x < 1.000, no shorten
If x >= 1.000 and x < 1.000.000, shorten to thousand value with "K" letter
If x >= 1.000.000 and x < 1.000.000.000, shorten to million value with "M" letter
If x >= 1.000.000.000, shorten to billion value with "B" letter
***Round***
If y = 0 => no round
If y = 1 => round to format ###.#
If y = 2 => round to format ###.##
If y = 3 => round to format ###.###
If y is other => round to default format of Tradingview
EXAMPLE
math_row(1.002342, 3) = 1.002
math_row(1923.321, 2) = 1.92K
math_row(221452133, 1) = 221.5M
Hope it useful and clear to you.
Number
Prime, E & PI Superiority CyclesIf you have been studying the markets long enough you will probably have noticed a certain pattern. Whichever trade entry/exit logic you try to use, it will go through phases of working really well and phases where it doesn't work at all. This is the markets way of ensuring anyone who sticks to an oversimplified, one-dimensional strategy will not profit. Superiority cycles are a method I devised by which code interrogates the nature of where price has been pivoting in relation to three key structures, the Prime Frame, E Frame and Pi Frame which are plotted as horizontal lines at these values:
* Use script on 1 minute chart ONLY
prime numbers up to 100: 2.0,3.0,5.0,7.0,11.0,13.0,17.0,19.0,23.0,27.0,29.0,31.0,37.0,41.0,43.0,47.0,53.0,59.0,61.0,67.0,71.0,73.0,79.0,83.0,89.0,97.0
multiples of e up to 100: 2.71828, 5.43656, 8.15484, 10.87312, 13.5914, 16.30968, 19.02796, 21.74624, 24.46452, 27.1828, 29.90108, 32.61936, 35.33764,
38.05592, 40.7742, 43.49248, 46.21076, 48.92904, 51.64732, 54.3656, 57.08388, 59.80216, 62.52044, 65.23872, 67.957, 70.67528, 73.39356000000001, 76.11184,
78.83012, 81.5484, 84.26668000000001, 86.98496, 89.70324, 92.42152, 95.13980000000001, 97.85808
multiples of pi up to 100: 3.14159, 6.28318, 9.424769999999999, 12.56636, 15.70795, 18.849539999999998, 21.99113, 25.13272, 28.27431, 31.4159, 34.55749,
37.699079999999995, 40.840669999999996, 43.98226, 47.12385, 50.26544, 53.40703, 56.54862, 59.69021, 62.8318, 65.97339, 69.11498, 72.25657, 75.39815999999999,
78.53975, 81.68133999999999, 84.82293, 87.96452, 91.10611, 94.2477, 97.38929
These values are iterated up the chart as seen below:
The script sums the distance of pivots to each of the respective frames (olive lines for Prime Frame, green lines for E Frame and maroon lines for Pi Frame) and determines which frame price has been reacting to in the least significant way. The worst performing frame is the next frame we target reversals at. The table in the bottom right will light up a color that corresponds to the frame color we should target.
Here is an example of Prime Superiority, where we prioritize trading from prime levels:
The table and the background color are both olive which means target prime levels. In an ideal world strong moves should start and finish where the white flags are placed i.e. in this case $17k and $19k. The reason these levels are 17,000 and 19,000 and not just 17 and 19 like in the original prime number sequence is due to the scaling code in the get_scale_func() which allows the code to operate on all assets.
This is E Superiority where we would hope to see major reversals at green lines:
This is Pi Superiority where we would hope to see major reversals at maroon lines:
And finally I would like to show you a market moving from one superiority to another. This can be observed by the bgcolor which tells us what the superiority was at every historical minute
Pi Frame Superiority into E Frame Superiority example:
Prime Frame Superiority into E Frame Superiority example:
Prime Frame Superiority into Pi Frame Superiority example:
By rotating the analysis we use to enter trades in this way we hope to hide our strategy better from market makers and artificial intelligence, and overall make greater profits.
Candle Number AnalysisAuthor: Marek Zatwarnicki
Inspired by: -
Category: Technical Analysis
Type: Indicator
Timeframe: 4H - 1MONTH
Index: ALL
About:
The indicator allows to examine the number of historical occurrences of candles in a given color, evaluate the risk and analyze returns of the next candle.
How to use:
Check with plotline how many candles of a given color have occurred so far and use the table to evaluate the risk.
Formula:
- Returns - ((close / open) - 1) * 100
- Returns Culminative - close / open
Overfitting: Overfitting free. Research only.
Disclaimer: Past good results do not guarantee future trading success. Please use the algorithm with caution and support it with your knowledge. Published algorithm decisions are not financial advice.
How To Identify Argument Type Of Number Using OverloadsExample overload functions accept loading of _value for types float, int, or string, then positively identifies the actual argument type of that specific loaded _value.
How To Identify Type Of NumberExample function accepts loading of _value for types float, int, or string, then identifies whether the loaded _value is a string number, string, or number.
Number FrameNumber frame for any number input between 0 - 10, to 5 decimal places (you can change these limits in the code).
Default value pi = 3.14159
Lucas Numbers - Horizontal levels█ OVERVIEW
Lucas numbers are related to the Fibonacci numbers and calculated using them as well. It is an easy formula where you'd take the golden ration to the power of n which in the case of this script that would be the revolutions. This script plots Lucas numbers as horizontal price lines. To run this script, turn your "Auto" scale off, and keep your chart on "Log" scale. it is important to keep your "Auto" scale off to be able to view your chart without distortions.
Enjoy!
Rule Number 1 Signals [ALERTS]Alerts version of rule number 1 signals, a long-only strategy for long term investors to help them enter positions more optimally
Rolling deviationsSometimes the market data follows normal distribution, in these cases it is more appropriate to utilize mean-based statistical techniques. This script plots the special case of seven-number summary with 1st, 2nd & 3rd standard deviations below and above the mean.
It also has "Log-space" switch which should be checked while using logarithmic scale.
The next version with minor visual improvs might arrive soon
Rolling summaryStatistical methods based on mean cannot be effective all the time when attributed to financial data since it doesn't usually follow normal distribution, the data can be skewed or/and have extreme values which can be described as outliers.
In order to deal with this problem it is appropriate to use median-based techniques.
The most common one is called five-number summary/box plot, which plots median of the dataset, 25th (Q1) & 75th (Q3) percentiles (the medians of lower & upper parts of the original dataset divided by the original median), and whiskers calculated by taking range between Q1 and Q3, multiplying it by 1.5 and adding it to Q3 and subtracting it from Q1. The values which are outside the whiskers are considered outliers. Default settings of the script correspond to the classic box plot.
Seven-number summary can be also plotted by this script, by turning on 4 additional percentiles/Bowley’s seven-figure summary by turning on first 2 additional percentiles and changing their values to 10 and 90 respectively.
P.S.: Mean can be also turned in just to check the difference.
Pseudo-Random Number Generators via Pine ScriptThese are my "Pseudo-Random Number Generators via Pine Script", having uniform distribution between 0 and 1. In my quest for sequential pseudo-random numbers in Pine, tinkering with mathematical chaos, I have come up with these three simple yet handy generators. I believe these may be useful in the future by developers of the Tradingview community.
NOTICE: Use it as you please, this is free code to implement into your new Pine projects. You don't have to ask for my permission to reuse these functions in your published scripts, simply because I have better things to do than answer requests for the reuse of these simplistic PRNG functions. I don't require accreditation for members to reuse these functions either. I simply don't want any credit. I only require that you respectfully put it to "good and proper use" complimenting the elaborate script you have in mind. I would however like to see some great ideas utilizing these when I randomly and accidentally come across them in the public library. I didn't know where to put this script, so I just tossed it into the "Trend Analysis" category.
The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. When available time provides itself, I will consider your inquiries, thoughts, and concepts presented below in the comments section, should you have any questions or comments regarding this indicator. When my indicators achieve more prevalent use by TV members, I may implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Number of digits before and after the decimal point - FunctionFunction - Number of digits before and after the decimal point
Detect the number of digits in integers and floats, before the decimal and after it.
It also works for negative numbers.
There are some rounding issues, but the currently maximum supported number can have safely up to 3 digits after the decimal point.
Prime Fib AvgsHey all,
Just thought some might find it useful to have a script of the first 7 numbers that are both fibonacci and that are prime numbers as simple moving averages and as exponential averages.
If anyone wants any other average type added to this script I can put out another version
Happy trading,
Snoop