type
status
date
slug
summary
AI summary
AI translation
tags
category
password
icon
By registering an account on OKX Crypto Exchange using the invitation link from blackcat1402, you can enjoy several benefits. These include a 10% rebate on spot contract trades, a 20% discount on fees, permanent access to blackcat1402 Membership and Advanced Indicators, free internal testing of the Advanced Trading System, and exclusive services such as member technical indicator customization and development.
OKX Crypto Exchange blackcat1402 invitation registration link:
Today, I am going to take you on a deep dive into a simple yet magical technical indicator - the Moving Average Envelope (ENV). It sounds like a mysterious enchantment, doesn't it? But in reality, this indicator is much more practical than you might think. It can help us uncover the secrets of market trends, just like the sharp eyes of a cat in the dark night!
First, let's uncover the mystery of ENV. ENV consists of three lines: a baseline and two enveloping lines around it. The baseline, usually a 20-day Simple Moving Average (SMA), is like a calm river, while the upper and lower enveloping lines act as the riverbanks, maintaining a certain distance. This distance is not random, but determined by setting a fixed percentage. Imagine it like a cat jumping on a tree, always maintaining a certain height and distance.
Next, let's take a look at the calculation method of ENV. Taking a 20-period SMA and a 10% envelope as an example, the upper and lower envelope lines are positioned 10% above and below the baseline. This is like a cat's leap, simple yet accurate and efficient. Actually, calculating the moving average envelope is not complicated at all! Using a 20-period simple moving average and a 10% envelope as an example:
Baseline = 20-period simple moving average
Upper envelope = 20-period simple moving average + (20-period simple moving average x 0.1)
Lower envelope = 20-period simple moving average - (20-period simple moving average x 0.1)
Because price trends lag behind moving average values, we should not ignore any signals when the price breaks through any of the envelope lines. The moving average envelope aims to keep most price activity within the envelope. Therefore, when the price breaks through the envelope, it is a strong indication and may foreshadow significant price fluctuations.
So, what is the function of ENV? Simply put, it can help us find opportunities for overbought and oversold conditions. In the stock market, it's like searching for the treats hidden by a cat - when the price breaks through the envelope lines, it may be a good opportunity to buy or sell. For example, in a bull market, if the price breaks through the upper envelope line, it gives us a strong signal that the upward trend may continue; conversely, in a bear market, when the price falls below the lower envelope line, it's like sounding a warning for a decline.
However, like all indicators, ENV is not foolproof. It needs to be used in conjunction with other technical tools, such as trend lines or pattern analysis, in order to capture market dynamics more accurately. It's like a cat relying on its sharp intuition and agile movements to catch its prey.
In the end, although the moving average envelope is simple, it can provide us with a powerful perspective and help us find a stable course in the waves of the stock market. It's like our guiding lighthouse in the stock market, keeping us away from danger and capturing opportunities.
This cat wants to say that although ENV is just one of many technical indicators, its practicality and flexibility are definitely worth exploring and applying. Just like a cat can always find joy in various environments, ENV can also help us find joy in trading in various market conditions! Hey, don't underestimate this cat, with ENV used properly, we can also become hunters in the stock market! The following code is what this cat is going to talk about in detail.
This code is a TradingView Pine Script script used to plot the Envelope indicator.
First, the script declares the version number of the script as 5 using
//@version=5
.Then, it defines an indicator called "Envelope", abbreviated as "Env". This indicator can be overlaid on the chart and allows customization of the time frame and whether or not to allow time gaps.
Next, an integer input variable
len
is created using the input.int()
function. This variable represents the length of the envelope and has a default value of 20. Users can adjust this parameter on the chart interface.Another float input variable
percent
is created using the input()
function. It has a default value of 10.0 and represents the percentage difference between the envelope and the baseline. Similarly, users can adjust this parameter as needed.Then, an input variable
src
is defined with a default value of the closing price (close
). It represents the data source used for calculating the envelope. Users can also choose other price data as the source.Next, a boolean input variable
exponential
is defined with a default value of false. If set to true, the baseline is calculated using exponential moving average (EMA). If set to false, the baseline is calculated using simple moving average (SMA).Based on the predefined parameters and conditions, calculate the baseline (
basis
) here:- If
exponential
is true, use theta.ema()
function to calculate the exponential moving average;
- If
exponential
is false, use theta.sma()
function to calculate the simple moving average.
Then, calculate the upper band (
upper
) and lower band (lower
) based on the baseline and percentage difference:- Upper band = baseline * (1 + k)
- Lower band = baseline * (1 - k)
Finally, three curves are plotted using the
plot()
function:- Curve 1: Baseline, colored line.
- Curve 2: Upper band, colored blue (#2962FF)
- Curve 3: Lower band, also colored blue (#2962FF)
Additionally, an opaque background area is filled between the upper and lower curves using the
fill()
function. The color of this area is defined by the RGBA color value (33, 150, 243, 95)
.- Author:blackcat1402
- URL:https://www.tradingview.com/u/blackcat1402//article/moving-average-envelope-en
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts