Three Anchored Moving Averages (VWAP / SMA / EMA)
This indicator allows users to anchor three types of moving averages (Simple Moving Average (SMA), Exponential Moving Average (EMA), and Volume Weighted Average Price (VWAP)) to specific points in time (anchor points)
Key Features:
Select from three Moving Average Types:
Simple Moving Average (SMA): Averages the closing prices over a specified period.
Exponential Moving Average (EMA): Gives more weight to recent prices, making it more responsive to new information.
Volume Weighted Average Price (VWAP): Averages the price weighted by volume, useful for understanding the average price at which the asset has traded over a period.
Up to Three Anchor Points:
Users can set up to three different anchor points to calculate the moving averages from specific dates and times. This allows for analysis of price action starting from significant points or specific events. For example, you can anchor to the low and high of a move to identify key levels or to points where the price takes off from a previous anchored MA.
Customisable Sentiment Options:
Each anchor point can be associated with a sentiment input (Auto, Bull, Bear, None), which influences if the MAs are displayed as lines or zones/bands:
Auto: Automatically determines the sentiment based on whether anchor points are on pivot highs and lows. If anchored to a pivot high, the system will assume a bearish sentiment and display a red band or zone between the MA OHLC4 and High. Anchoring to a pivot low will display a green band (OHLC4 - Low).
Bull: Forces a bullish sentiment (Green Band - OHLC4 to Low)
Bear: Forces a bearish sentiment (Red Band - OHLC4 to High)
None: Ignores sentiment and displays a single line (OHLC4)
Chart Matching:
The indicator includes an option to display the moving averages only if the chart symbol matches a specified ticker. This feature ensures that the indicator is relevant to the specific asset being analysed.
How to Use the Indicator:
1. Set Anchor Points: When added to your chart, select three anchor points by point and click. If you only wish to anchor to a single point, click on that point three times and disable the other two in settings once the indicator is applied.
2. Select Moving Average Type: Choose between SMA, EMA, or VWAP using the dropdown menu. EMAs are the most responsive.
3. Enable/Disable Anchor Points: Use the checkboxes to enable or disable each anchor point.
4. Select Sentiment Type: Choose between Auto, Bull, Bear, or None.
5. Chart Matching: Optionally, specify a chart symbol to restrict the indicator's display to that particular asset.
6. Interpret the Plots: The indicator plots the high, mid, and low values of the selected moving average type from each anchor point. The fills between these plots help identify potential support and resistance zones. These should be used as points of interest for pullback reversals or potential continuation if the price breaks through.
Practical Applications:
Trend Analysis: Identify the overall trend direction from specific historical points.
Support and Resistance: Determine key dynamic support and resistance levels based on anchored moving averages.
Event-Based Analysis: Anchor the moving averages to significant events (e.g., earnings releases, economic data) to study their impact on price trends.
Multi Timeframe Analysis: Higher Timeframe Anchors can be used to identify longer term trend analysis. Switching to a lower timeframe for execution triggers at these points wont distort the MA levels as they are anchored to a specific point in time
Intraday or Swing Trading: trend analysis using anchor points can be used for any style of trading (Intraday / Swing / Invest). Use anchored levels as points of interest and wait for hints in price action to try and catch the next move.
AMA
Adaptive Moving Average (AMA) Signals (Zeiierman)█ Overview
The Adaptive Moving Average (AMA) Signals indicator, enhances the classic concept of moving averages by making them adaptive to the market's volatility. This adaptability makes the AMA particularly useful in identifying market trends with varying degrees of volatility.
The core of the AMA's adaptability lies in its Efficiency Ratio (ER), which measures the directionality of the market over a given period. The ER is calculated by dividing the absolute change in price over a period by the sum of the absolute differences in daily prices over the same period.
⚪ Why It's Useful
The AMA Signals indicator is particularly useful because of its adaptability to changing market conditions. Unlike static moving averages, it dynamically adjusts, providing more relevant signals that can help traders capture trends earlier or identify reversals with greater accuracy. Its configurability makes it suitable for various trading strategies and timeframes, from day trading to swing trading.
█ How It Works
The AMA Signals indicator operates on the principle of adapting to market efficiency through the calculation of the Efficiency Ratio (ER), which measures the directionality of the market over a specified period. By comparing the net price change to total price movements, the AMA adjusts its sensitivity, becoming faster during trending markets and slower during sideways markets. This adaptability is enhanced by a gamma parameter that filters signals for either trend continuation or reversal, making it versatile across different market conditions.
change = math.abs(close - close )
volatility = math.sum(math.abs(close - close ), n)
ER = change / volatility
Efficiency Ratio (ER) Calculation: The AMA begins with the computation of the Efficiency Ratio (ER), which measures the market's directionality over a specified period. The ER is a ratio of the net price change to the total price movements, serving as a measure of the efficiency of price movements.
Adaptive Smoothing: Based on the ER, the indicator calculates the smoothing constants for the fastest and slowest Exponential Moving Averages (EMAs). These constants are then used to compute a Scaled Smoothing Coefficient (SC) that adapts the moving average to the market's efficiency, making it faster during trending periods and slower in sideways markets.
Signal Generation: The AMA applies a filter, adjusted by a "gamma" parameter, to identify trading signals. This gamma influences the sensitivity towards trend or reversal signals, with options to adjust for focusing on either trend-following or counter-trend signals.
█ How to Use
Trend Identification: Use the AMA to identify the direction of the trend. An upward moving AMA indicates a bullish trend, while a downward moving AMA suggests a bearish trend.
Trend Trading: Look for buy signals when the AMA is trending upwards and sell signals during a downward trend. Adjust the fast and slow EMA lengths to match the desired sensitivity and timeframe.
Reversal Trading: Set the gamma to a positive value to focus on reversal signals, identifying potential market turnarounds.
█ Settings
Period for ER calculation: Defines the lookback period for calculating the Efficiency Ratio, affecting how quickly the AMA responds to changes in market efficiency.
Fast EMA Length and Slow EMA Length: Determine the responsiveness of the AMA to recent price changes, allowing traders to fine-tune the indicator to their trading style.
Signal Gamma: Adjusts the sensitivity of the filter applied to the AMA, with the ability to focus on trend signals or reversal signals based on its value.
AMA Candles: An innovative feature that plots candles based on the AMA calculation, providing visual cues about the market trend and potential reversals.
█ Alerts
The AMA Signals indicator includes configurable alerts for buy and sell signals, as well as positive and negative trend changes.
-----------------
Disclaimer
The information contained in my Scripts/Indicators/Ideas/Algos/Systems does not constitute financial advice or a solicitation to buy or sell any securities of any type. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.
My Scripts/Indicators/Ideas/Algos/Systems are only for educational purposes!
Sakura 2The oscillator uses an adaptive moving average as input to another RSI oscillator and is designed to provide a way to minimize the impact of corrections on the output of the oscillator without significant lag.
An additional trigger line is present in order to provide entry points from intersections between the oscillator and the trigger line.
I'll be working on the code to add and describe the privileges and the best settings
Settings
=Lengthy : period of the oscillator
=Power : controls the sensitivity of the oscillator to retracements, with higher values minimizing the sensitivity to retracements.
=Src : source input of the indicator
The indicator also includes the following graphical settings:
=Gradient : Determines the color mode to use for the gradient, options include "Red To Green", "Red To Blue" and "None", with "None" displaying no gradient.
=Color fill : Determines whether to fill the area between the oscillator and the trigger line or not, by default "On".
=Circles : Determines whether to show circles highlighting the crosses between the oscillator and the trigger line.
Anchored Moving Averages - InteractiveWhat is an Anchored Moving Average?
An anchored moving average (AMA) is created when you select a point on the chart and start calculating the moving average from there.
Thus the moving average’s denominator is not fixed but cumulative and dynamic. It is similar to an Anchored VWAP, but neglecting the volume data, which may be useful when this data is not reliable and you want to focus just on price.
Main Features
This interactive indicator allows you to select 3 different points in time to plot their respective moving averages. As soon as you add the indicator to your chart you will be asked to click on the 3 different points where you want to start the calculation for each moving average.
Each AMA (Anchored Moving Average) will be colored according to its slope, using a gradient defined by two user chosen colors in the indicator menu.
The default source for the calculation is the pivot price (HLC3) but can also be modified in the menu.
Examples:
Enjoy!
Better Heiken-Ashi Candles w/ Expanded Source Types [Loxx]Better Heiken-Ashi Candles w/ Expanded Source Types is an indicator to compare regular candles to traditional Heiken-Ashi candles to "better" Heiken Ashi candles. This indicator and comparison study appears an oscillator. The purpose of this indicator is to demonstrate a better way to calculate HA candles and also to demonstrate expanded source types. This indicator is meant to be used by advanced Pine Coders who wish to add fine-tuning to their indicators and strategies.
What are Heiken Ashi "better" candles?
The "better formula" was proposed in an article/memo by BNP-Paribas (In Warrants & Zertifikate, No. 8, August 2004 (a monthly German magazine published by BNP Paribas, Frankfurt), there is an article by Sebastian Schmidt about further development (smoothing) of Heikin-Ashi chart.)
They proposed to use the following :
(Open+Close)/2+(((Close-Open)/(High-Low))*ABS((Close-Open)/2))
instead of using :
haClose = (O+H+L+C)/4
According to that document the HA representation using their proposed formula is better than the traditional formula.
What are traditional Heiken-Ashi candles?
The Heikin-Ashi technique averages price data to create a Japanese candlestick chart that filters out market noise.
Heikin-Ashi charts, developed by Munehisa Homma in the 1700s, share some characteristics with standard candlestick charts but differ based on the values used to create each candle. Instead of using the open, high, low, and close like standard candlestick charts, the Heikin-Ashi technique uses a modified formula based on two-period averages. This gives the chart a smoother appearance, making it easier to spots trends and reversals, but also obscures gaps and some price data.
What's going on with this indicator?
- First, we have the options to select the candlestick type: Regular, HA, HA Better
- Next, and to demonstrate the expanded source types, I've added a simple moving average. In the drop down for the SMA source you'll notice something very different from the typical TradingView source selector. Here's how to decode the new names for the sources:
Close = close
Open = open
High = high
Low = low
Median = hl2
Typical = hlc3
Weighted = hlcc4
Average = ohlc4
Average Median Body = (open+close)/2
Trend Biased = (see code, too complex to explain here)
Trend Biased (extreme) = (see code, too complex to explain here)
... for HA and HA better, see the same set up as above but with different open and close values to calcualate the other source types
- For the HA better calculations, we run the close value through either an Adaptive, Kaufman, or T3 smoothing filter. The length for these smoothing filters, either 2 or 3, can be found in the code and is a constant value that shouldn't be changed. This smoothing is in inline with what is described in the article mentioned above
- Lastly, I've placed an SMA over the oscillator so that the user can test out the various sources explained above
Included:
- Toggle on/off bar coloring
Ehlers Mother Of Adaptive Moving Averages [CC]The Mother Of Adaptive Moving Averages was created by John Ehlers (Rocket Science For Traders pgs 182-183) and this is definitely my favorite Ehlers moving average script. This works as a trend indicator and a typical moving average. When the mama is above the fama then the stock is in an uptrend and vice versa. Of course it is also good when the price is above the fama and mama lines. Buy when the indicator line is green and sell when it is red.
Let me know if there are other indicator scripts you would like to see me publish or if you want something custom done!
[LunaOwl] 11 kinds of Adaptive MA Model作品: 11種自適應性平滑模型
It integrates eleven kinds of adaptive moving average method. At first, I just wanted to make a ATR. Later, the price series ±N*ATR mult, to form two series. Then use the concept of support/resistance breakthrough to design it, and then two adaptive series formation channels were formed. Take the average of the two series as the signal. When the price crosses the signal, it's judged to be long or short.
整合了十一種能夠自適應性的移動平均模型。起初只是想要做一個基本款ATR指標,後來將價格加減N個ATR倍數,形成兩條序列形成通道,再使用支撐阻力突破的概念去設計它,再形成兩條自適應性的序列形成通道,再取中間值當成信號。當價格與信號交叉,則判斷作多或者作空。
--------------------------*
Parameter 設置參數
Resolution: The default is "the same as the variety". Is a named constant for resolution input type of input function.
商品分辨率:預設與品種相同。是input函數的時間周期輸入類型的命名常量。
Smoothing: The default is Recursive Moving Average(RMA). It can choose other methods, the table is as follows.
平滑類型:預設是「遞回平均」,可以選擇其它方法,列表如下。
列表 / The table of moving averages is as follows:
//****中英對照表*****##______________________________________
1. 遞回平均 || Recursive Moving Average
2. 簡單平均 || Simple Moving Average
3. 指數平均 || Exponential Moving Average
4. 加權平均 || Weighted Moving Average
5. 船體平均 || Hull Moving Average
6. 成交量加權 || Volume Weighted Moving Average
7. 對稱加權 || Symmetric Weighted Moving Average
8. 雙重指數 || Double Exponential Moving Average
9. 三重指數 || Triple Exponential Moving Average
10. 高斯分佈 || Arnaud Legoux Moving Average
11. 提爾森T3 || Tillson T3 Moving Average
//##_________________________________________________________
Candle Mode: There are three versions, original, two-color and four-color.
燭台模式:預設模式只區分趨勢,可以改成原版蠟燭或四種顏色版本。
Length: The default is 14, usually no need to adjust.
平滑期數:預設值是14,基本上不用理它。
Occurrence: The default is 1. The range is 0~10. The larger the value, the more delayed. If zero will become too sensitive and noise.
滯後性:預設值是1。調整範圍是0~10,數值愈大信號愈延遲,如果值為0,會變得過於敏捷,那將會失去平滑的意義。
N multiple: The default is 0.618, can be set to 1. The range is 0.382~3.000.
倍數N:預設值是0.618,也可以設定1,最低是0.382,最大是3。
--------------------------*
1. Candle Mode can set the original candle, cancel candle trend color changes. However, the background will still be filled.
可以設定顯示原版的蠟燭線,背景與線並不會消失。
2. Four-color version of candles. It shows changes in trends and prices.
四色版本的蠟燭線,可以顯示趨勢與每日收盤價的變化。
[CS] AMA Strategy - Channel Break-Out"There are various ways to detect trends with moving averages. The moving average is a rolling filter and uptrends are detected when either the price is above the moving average or when the moving average’s slope is positive.
Given that an SMA can be well approximated by a constant-α AMA, it makes a lot of sense to adopt the AMA as the principal representative of this family of indicators. Not only it is potentially flexible in the definition of its effective lookback but it is also recursive. The ability to compute indicators recursively is a very big positive in latency-sensitive applications like high-frequency trading and market-making. From the definition of the AMA, it is easy to derive that AMA > 0 if P(i) > AMA(i-1). This means that the position of the price relative to an AMA dictates its slope and provides a way to determine whether the market is in an uptrend or a downtrend."
You can find this and other very efficient strategies from the same author here:
www.amazon.com
In the following repository you can find this system implemented in lisp:
github.com
To formalize, define the upside and downside deviations as the same sensitivity moving averages of relative price appreciations and depreciations
from one observation to another:
D+(0) = 0 D+(t) = α(t − 1)max((P(t) − P(t − 1))/P(t − 1)) , 0) + (1 − α(t − 1))D+(t − 1)
D−(0) = 0 D−(t) = −α(t − 1)min((P(t) − P(t − 1))/P(t − 1)) , 0)+ (1 − α(t − 1))D−(t − 1)
The AMA is computed by
AMA(0) = P(0) AMA(t) = α(t − 1)P(t) + (1 − α(t − 1))AMA(t − 1)
And the channels
H(t) = (1 + βH(t − 1))AMA(t) L(t) = (1 − βL(t − 1))AMA(t)
For a scale constant β, the upper and lower channels are defined to be
βH(t) = β D− βL(t) = β D+
The signal-to-noise ratio calculations are state dependent:
SNR(t) = ((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) > H(t)
SNR(t) = −((P(t) − AMA(t − 1))/AMA(t − 1)) / β D−(t) IfP(t) < L(t)
SNR(t) = 0 otherwise.
Finally the overall sensitivity α(t) is determined via the following func-
tion of SNR(t):
α(t) = αmin + (αmax − αmin) ∗ Arctan(γ SNR(t))
Note: I added a moving average to α(t) that could add some lag. You can optimize the indicator by eventually removing it from the computation.
Heikin-Ashi Smoothed with option to change MA types CryptoJoncisPine Script version=3
Author CryptoJoncis
Heikin-Ashi Smoothed
The Heikin-Ashi Smoothed study is based upon the standard Heikin-Ashi study with additional moving average calculations. The following is the calculation formula for the bars:
1. The current bar Open, High, Low, Close values are smoothed individually by using the moving average type specified by the Moving Average Type 1 Input with a length/period specified by the Moving Average Period 1 Input.
2. The Heikin-Ashi bar Open, High, Low, Close values are set using the smoothed values from step 1. This is performed using the standard Heikin-Ashi formula.
3. The final Heikin-Ashi Open, High, Low, Close values are calculated by doing a second smoothing of the bar values from step 2 by using the moving average type specified by the Moving Average Type 2 Input with a length/period specified by the Moving Average Period 2 Input.
If you choose to tick the box where it offers to use only one smoothed HA then it skips the third/final step and you do not need to choose the second MA type for it to work.
Remember, using FRAMA, always make sure you use even number for length.
For simple Heikin-Ashi, please tick single smoothed and DEFAULT (Not smoothed as there are no MA used)
Heikin-Ashi bars are calculated:
1. Close = (Open + High + Low + Close) / 4
This is the average price of the current bar.
2. Open = (Open of Previous Bar + Close of Previous Bar) / 2
This is the midpoint of the previous bar.
3. High = Max of (High, Open, Close)
Highest value of the three.
4. Low = Min of (Low, Open, Close)
Lowest value of the three.
Any questions/suggestions/errors or spelling mistakes? Please leave a comment and let me know. I will try to fix it.
This took me few days to finish, so I hope you will find it useful.
Would you like to have more MA type choices? Please comment down with any other which aren't included in this indicator and I will research them and add.
MA included in this script:
Tillson Moving Average (T3)
Double Exponential Moving Average (DEMA)
Arnaud Legoux Moving Average (ALMA)
Least Squares Moving Average (LSMA)
Simple Moving Average (SMA)
Exponential Moving Average (EMA)
Weighted Moving Average (WMA)
Smoothed Moving Average (SMMA)
Triple Exponential Moving Average (TEMA)
Hull Moving Average (HMA)
Adaptive moving average (AMA)
Fractal Adaptive Moving Average (FAMA)
Variable Index Dynamic Average (VIDYA)
Triangular Moving Average (TRIMA)
You can use,publish,modify this code in any way as you wish, but only if you reference me after.
You are not allowed to sell it as it is.
If this code is useful to you, then consider to buy me a coffee (or better a pint of beer) by donating Bitcoin or Etherium to:
BTC: 3FiBnveHo3YW6DSiPEmoCFCyCnsrWS3JBR
ETH: 0xac290B4A721f5ef75b0971F1102e01E1942A4578
References:
www.sierrachart.com
www.investopedia.com
www.binarytribune.com
www.investopedia.com
www.stockfetcher.com
www.mql5.com
www.incrediblecharts.com
help.cqg.com
www.blastchart.com
Adaptive Moving AverageAdaptive Moving Average indicator script. This indicator was originally developed by Vitali Apirine (Stocks & Commodities V.36:5: Adaptive Moving Averages).