OPEN-SOURCE SCRIPT

Bar Dependent Moving Average

Uppdaterad
Imagine using an exercising strategy from a gym coach who retired 10 years ago as there dozens of other trainers who constantly try to adapt and find a better approach. You would be missing out.


It's the same with using fixed periods, you just look back.

How about an exercising strategy from a gym coach who is simultaneously trying to adapt himself?

How could you figure out a strategy that adapts with the market as the market is indirectly finding a better approach to take you out?
Relative Moving Averages simply speaking count the total amount of bars and divide it by the period for which you want to use the moving average. Instead of looking at the last X bars, it divides the total amount of bars / X as the moving average period.
It takes all bars into account, the entire chart history essentially turning it into an adaptive moving average, in the example mentioned above into an adaptive exercising strategy.


The Bar Dependent Moving Average Periods are 2,3,5,8 etc., i.e. the entire fibonacci sequence up to 4181.
The white line is the relative fibonacci moving average, which is calculated by adding all Fibonacci Bar Dependent Moving Averages with one another / by the total amount of fibonacci numbers used i.e. 18.
The bar-dependent fibonacci moving average is upon further investigation (on shorter timeframes <30m) a useful support/resistance indicator since the price tends to wick/consolidate or fully break through the fibonoacci bar dependent moving average.



If there are more than 5000 bars of Candlestick data enable the lock in the settings menu to limit the maximum last X bars back to 5000 to make it possible for Tradingview to run the script since Tradingview does not allow it to look more than 5000 bars back.
Versionsinformation
Overlay is true, minor coloring update.
Versionsinformation
Lock of 5000 bypassed by starting counter from highest timeframe and then going lower once 5000 is crossed.
Since this moving average is the same on every timeframe it doesn't matter which timeframe you choose.
Versionsinformation
Fibonacci BDMA's added, relative timeframe function taken out for customization.
Versionsinformation
Few errors fixed. Relative Timeframe Integration isn't fully functional, the Flow-Chart is ready to make it work.
As of now a temporary fix has been offered, which is close to being definitively accurate.
Moving Averages

Skript med en öppen källkod

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. Du kan ange den som favorit för att använda den i ett diagram.

Vill du använda det här skriptet i ett diagram?

Frånsägelse av ansvar