TradingView
insideandup
2021년 12월 16일 오후 11시 35분

Pythagorean Means of Moving Averages 

Bitcoin / U.S. dollarBitstamp

설명

DESCRIPTION
Pythagorean Means of Moving Averages

1. Calculates a set of moving averages for high, low, close, open and typical prices, each at multiple periods.
Period values follow the Fibonacci sequence.
The "short" set includes moving average having the following periods: 5, 8, 13, 21, 34, 55, 89, 144, 233, 377.
The "mid" set includes moving average having the following periods: 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597.
The "long" set includes moving average having the following periods: 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181.
2. User selects the type of moving average: SMA, EMA, HMA, RMA, WMA, VWMA.
3. Calculates the mean of each set of moving averages.
4. User selects the type of mean to be calculated: 1) arithmetic, 2) geometric, 3) harmonic, 4) quadratic, 5) cubic. Multiple mean calculations may be displayed simultaneously, allowing for comparison.
5. Plots the mean for high, low, close, open, and typical prices.
6. User selects which plots to display: 1) high and low prices, 2) close prices, 3) open prices, and/or 4) typical prices.
7. Calculates and plots a vertical deviation from an origin mean--the mean from which the deviation is measured.
8. Deviation = origin mean x a x b^(x/y)/c.
9. User selects the deviation origin mean: 1) high and low prices plot, 2) close prices plot, or 3) typical prices plot.
10. User defines deviation variables a, b, c, x and y.
Examples of deviation:
a) Percent of the mean = 1.414213562 = 2^(1/2) = Pythagoras's constant (default).
b) Percent of the mean = 0.7071067812 = [1/sqrt(2)] = [sqrt(2)/2] = sin 45˚ = cos 45˚.
11. Displaces the plots horizontally +/- by a user defined number of periods.

PURPOSE

1. Identify price trends and potential levels of support and resistance.

CREDITS

1. "Fibonacci Moving Average" by Sofien Kaabar: two plots, each an arithmetic mean of EMAs of 1) high prices and 2) low prices, with periods 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181.
2. "Solarized" color scheme by Ethan Schoonover.

릴리즈 노트

1) Added a list of mathematical constants to select as a deviation multiplier.
2) Edited script notes.

릴리즈 노트

1) updated script notes.
2) removed unrelated indicators from chart.

릴리즈 노트

1. Updated constants list.

릴리즈 노트

1. Added selection for period lengths based on either Fibonacci Numbers, Lucas Numbers, or Mersenne primes.

릴리즈 노트

Updated variable names.

릴리즈 노트

1. Added additional number sequences.

릴리즈 노트

Edited script: 1) moving averages periods, 2) new number sequences, 3) new constants.
Added script notes.

릴리즈 노트

1. Added option to calculate double and triple exponential moving averages. Moving average options include: SMA, EMA, DEMA, TEMA, RMA, WMA, VWMA.
2. Chart displayed shows the cubic mean of EMAs having period length values equal to Mersenne prime exponents (3, 5, 7, 13, 17, 19, 31, 61, 89, 107, 127, 521, 607, 1279, 2203).

릴리즈 노트

Added some flexibility in how the plots can be adjusted:
1. increase all moving averages' periods by a specified number of periods.
2. apply the above to high prices or low prices, open prices or close prices, or typical prices.
3. added the OEIS reference number next to the number sequence names within the script notes.

릴리즈 노트

1. Added more number sequences: Pell, Padovan, Perrin, Catalan, Narayana.
2. Added more moving averages: Triple-EMA (TEMA), Quadruple-EMA (QEMA), Quintuple-EMA (PEMA).

Note: TEMA, QEMA, and PEMA may not display when used with "long" or "mid" lookback periods with some number sequences. If TEMA, QEMA, or PEMA do not display, select a shorter lookback period, e.g., "mid" or "short", or a number sequence having fewer periods included within the current lookback selection.

릴리즈 노트

1. Added the option to displace plots horizontally: 1) plots and deviations generated from Open, High, Low, and Close prices separately from 2) plots generated from Typical Prices.
2. Added the Jacobsthal number sequence.

릴리즈 노트

Added options to plot 2 reference moving averages and displace these +/- horizontally by a specified number of periods.

릴리즈 노트

1. Added option to choose Zero Lag Exponential Moving Averages. The selected moving average type is what is used in mean calculations.
2. Fixed error in mean equation script notes. Plotted mean was correct. Notes were incorrect, now corrected.
3. Change optional defaults as follows: Cubic mean of EMAs, with EMA periods equal to the Lucas Numbers. (Lucas numbers are related to Fibonacci numbers in that their ratio is also equal to the Golden Ratio.) Offset from mean of typical price (High + Low + Close) / 3 EMAs equal to 3x the Golden Ratio. Mean of typical prices is shifted forward 29 periods. Optional reference moving averages displayed are 50 and 250 EMA.

릴리즈 노트

1. Corrected a typo in period lengths
2. Added more reference MAs

릴리즈 노트

Added Tillson's T3 moving average.

릴리즈 노트

Added different options for source for the four reference plots

릴리즈 노트

Fixed some errors in the script notes.
Added fill between mean of moving averages sourcing typical prices and the same mean displaced by a specified number of periods.

릴리즈 노트

for mean of moving averages prices source, removed typical and added average which includes typical, mean, and other calculations for average price. User selects the calculation to apply.

릴리즈 노트

Modified average price calculations

릴리즈 노트

Removed the reference moving averages.
Added an option to display or hide all of the moving averages used in the calculation of the mean of moving averages.
Additionally, these moving averages can be translated horizontally by a specified number of periods.

릴리즈 노트

Adjusted display of moving averages.

릴리즈 노트

corrected an error found in previous update

릴리즈 노트

1) Edited code for plot displacement.
2) Edited notes.

릴리즈 노트

Edited notes.

릴리즈 노트

Updated defaults

릴리즈 노트

Added constants, corrected minor typos.

릴리즈 노트

Changed defaults and variable names.

릴리즈 노트

More typos found. These are variable names/descriptions only.

릴리즈 노트

Edited defaults.

릴리즈 노트

Found more typos in descriptions.

릴리즈 노트

Edited script notes. Updated chart.
코멘트
insideandup
I created this indicator as an experiment to see the effects 1) different moving average types with 2) periods following different classic number sequences might have on 3) different mean calculations, and also apply 4) offset plots from plotted means equal to multiples of different classic mathematical constants, and to see if the result could provide some insight on support and resistance levels for different crypto and stocks. I later added 5) reference moving averages to compare usefulness of these basic calculations to the that of the more involved mean of moving averages calculations. I included 6) the option to shift all mean plots and reference plots horizontally +/- by a user specified number of periods.

Thus far, the number sequences I keep going back to are the Lucas numbers, Pell numbers, Narayana's cow numbers, and the Mersenne primes exponents. The offsets I've used the most are some multiple of the Golden Ratio, Silver Ratio, or 27^(1/2). The offset often needs to be reduced for shorter timeframes. For example, 5x a constant on the day or week chart, might need to be changed to 3x or 2x the same constant on an intraday chart.

On charts, visual difference between offsets calculated using mathematical constants might be trivial unless one were to expect price to conform to the penny. But this experiment only pursues humble curiosity.

Note: visit oeis.org for more information about number sequences. Read about Metallic means here: wikipedia.org/wiki/Metallic_mean

Fibonacci numbers sequence (OEIS A000045): 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181... The ratio between two consecutive Fibonacci numbers converges to (1+√5)/2, the golden ratio. The golden ratio is related to the pentagon.

Lucas numbers sequence (OEIS A000032, A000204): 2, 1, 3, 4, 7, 11, 18, 29, 47, 76, 123, 199, 322, 521, 843, 1364, 2207, 3571, 5778... The ratio between two consecutive Lucas numbers converges to (1+√5)/2, the golden ratio.

Pell numbers sequence (OEIS A000129): 0, 1, 2, 5, 12, 29, 70, 169, 408, 985, 2378, 5741... The ratio between two consecutive Pell numbers converges to 1 + 2^(1/2), the silver ratio. Silver ratio is related to the regular octagon.
crypteisfuture
@insideandup, Awesome work, thank you for the information, was interesting to read!
insideandup
@crypteisfuture, Thank you! =)
tradingaccount7777777
@insideandup, Very interesting, thanks so much.
insideandup
Mikeoly
Lagging and some time not working,fix 😕 issue.

Thanks 😊
insideandup
@Mikeoly, The indicator does not need to be fixed, but will not print for all names on all timeframes. The reason for this is because the lookback period is very long, and must be long in order to analyze data as it does. There are notes in the code that explain the lookback periods and number of bars per period that are averaged for each number sequence you might choose. If the chart has not printed enough bars, the indicator will not print. For example, the Narayana sequence requires 4023 bars to print when the "lookback setting is set to "long". Changing the chart timeframe to hours or minutes may produce enough bars to print the indicator. Or, in the settings, you can change the "Lookback" setting to "long", "mid", or "short". Changing to "short" may all the indicator to print.
biokon70
Amazing 🤩
더보기