Weighted CG Oscillator with ATRATR-Weighted CG Oscillator
The ATR-Weighted CG Oscillator is an enhanced version of the Center of Gravity (CG) Oscillator, originally developed by John Ehlers . By adding the Average True Range (ATR) to dynamically adjust the oscillator’s values based on market volatility, this indicator aims to make trend signals more responsive to price changes, offering an adaptive tool for trend analysis.
Functionality Overview :
The CG Oscillator, a classic trend-following indicator, has been modified here to incorporate the ATR for improved context and adaptability in different market conditions. The indicator calculates the CG Oscillator and scales it by dividing the ATR by the closing price to normalize for volatility. This creates a “weighted” CG Oscillator that generates more contextually relevant signals. A colored line shows green for long signals (above the long threshold), red for short signals (below the short threshold), and gray for neutral conditions.
Input Parameters :
CGO Length : Sets the period of the CG Oscillator calculation.
ATR Length : Determines the period of the ATR calculation. Longer periods smooth out the volatility impact.
Long Threshold : The threshold that triggers a long signal; a long (green) signal occurs when the weighted CG Oscillator crosses above this level.
Short Threshold : The threshold that triggers a short signal; a short (red) signal occurs when the weighted CG Oscillator crosses below this level.
Source : Specifies the data source for CG Oscillator calculations, with the default set to the closing price.
Recommended Use :
This indicator is designed to be an adaptive tool, not your sole resource. To ensure its effectiveness, it’s essential to backtest the indicator on your chosen asset over your preferred timeframe. Market dynamics vary, so testing the indicator’s parameters—especially the thresholds—will allow you to find the settings that best suit your strategy. While the default values work well for some scenarios, customizing the settings will help align the indicator with your unique trading style and the asset’s characteristics.
Centerofgravity
CofG Oscillator w/ Added Normalizations/TransformationsThis indicator is a unique study in normalization/transformation techniques, which are applied to the CG (center of gravity) Oscillator, a popular oscillator made by John Ehlers.
The idea to transform the data from this oscillator originated from observing the original indicator, which exhibited numerous whips. Curious about the potential outcomes, I began experimenting with various normalization/transformation methods and discovered a plethora of interesting results.
The indicator offers 10 different types of normalization/transformation, each with its own set of benefits and drawbacks. My personal favorites are the Quantile Transformation , which converts the dataset into one that is mostly normally distributed, and the Z-Score , which I have found tends to provide better signaling than the original indicator.
I've also included the option of showing the mean, median, and mode of the data over the period specified by the transformation period. Using this will allow you to gather additional insights into how these transformations effect the distribution of the data series.
I've also included some notes on what each transformation does, how it is useful, where it fails, and what I've found to be the best inputs for it (though I'd encourage you to play around with it yourself).
Types of Normalization/Transformation:
1. Z-Score
Overview: Standardizes the data by subtracting the mean and dividing by the standard deviation.
Benefits: Centers the data around 0 with a standard deviation of 1, reducing the impact of outliers.
Disadvantages: Works best on data that is normally distributed
Notes: Best used with a mid-longer transformation period.
2. Min-Max
Overview: Scales the data to fit within a specified range, typically 0 to 1.
Benefits: Simple and fast to compute, preserves the relationships among data points.
Disadvantages: Sensitive to outliers, which can skew the normalization.
Notes: Best used with mid-longer transformation period.
3. Decimal Scaling
Overview: Normalizes data by moving the decimal point of values.
Benefits: Simple and straightforward, useful for data with varying scales.
Disadvantages: Not commonly used, less intuitive, less advantageous.
Notes: Best used with a mid-longer transformation period.
4. Mean Normalization
Overview: Subtracts the mean and divides by the range (max - min).
Benefits: Centers data around 0, making it easier to compare different datasets.
Disadvantages: Can be affected by outliers, which influence the range.
Notes: Best used with a mid-longer transformation period.
5. Log Transformation
Overview: Applies the logarithm function to compress the data range.
Benefits: Reduces skewness, making the data more normally distributed.
Disadvantages: Only applicable to positive data, breaks on zero and negative values.
Notes: Works with varied transformation period.
6. Max Abs Scaler
Overview: Scales each feature by its maximum absolute value.
Benefits: Retains sparsity and is robust to large outliers.
Disadvantages: Only shifts data to the range , which might not always be desirable.
Notes: Best used with a mid-longer transformation period.
7. Robust Scaler
Overview: Uses the median and the interquartile range for scaling.
Benefits: Robust to outliers, does not shift data as much as other methods.
Disadvantages: May not perform well with small datasets.
Notes: Best used with a longer transformation period.
8. Feature Scaling to Unit Norm
Overview: Scales data such that the norm (magnitude) of each feature is 1.
Benefits: Useful for models that rely on the magnitude of feature vectors.
Disadvantages: Sensitive to outliers, which can disproportionately affect the norm. Not normally used in this context, though it provides some interesting transformations.
Notes: Best used with a shorter transformation period.
9. Logistic Function
Overview: Applies the logistic function to squash data into the range .
Benefits: Smoothly compresses extreme values, handling skewed distributions well.
Disadvantages: May not preserve the relative distances between data points as effectively.
Notes: Best used with a shorter transformation period. This feature is actually two layered, we first put it through the mean normalization to ensure that it's generally centered around 0.
10. Quantile Transformation
Overview: Maps data to a uniform or normal distribution using quantiles.
Benefits: Makes data follow a specified distribution, useful for non-linear scaling.
Disadvantages: Can distort relationships between features, computationally expensive.
Notes: Best used with a very long transformation period.
Conclusion
Feel free to explore these normalization/transformation techniques to see how they impact the performance of the CG Oscillator. Each method offers unique insights and benefits, making this study a valuable tool for traders, especially those with a passion for data analysis.
Ehlers Stochastic Center Of Gravity [CC]The Stochastic Center Of Gravity Indicator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pgs 79-80), and this is one of the many cycle scripts that I have created but not published yet because, to be honest, I don't use cycle indicators in my everyday trading. Many of you probably do, so I will start publishing my big backlog of cycle-based indicators. These indicators work best with a trend confirmation or some other confirmation indicator to pair with it. The current cycle is the length of the trend, and since most stocks generally change their underlying trend quite often, especially during the day, it makes sense to adjust the length of this indicator to match the stock you are using it on. As you can see, the indicator gives constant buy and sell signals during a trend which is why I recommend using a confirmation indicator.
I have color-coded it to use lighter colors for normal signals and darker colors for strong signals. Buy when the line turns green and sell when it turns red.
Let me know if there are any other scripts you would like to see me publish!
COG SSMACD COL combo with ADX Filter [orion35]This indicator consists of a combination of indicators produced by the most valuable developers in the market.
These are: Center of Gravity (COG) and Super Smoothed MACD (SSMACD) shared by @KivancOzbilgic and Center of Linearity (COL) shared by @alexgrover
I produced this indicator by writing new conditions that compare the signals given by these indicators with each other. I re-coded the change in the thickness of the cloud from the COL indicator as the middle horizontal line with varying color intensity and type. I have provided options for switching between these three indicators when desired.
Note: The strongest signals in the indicator are the blue colored triangles. Moderately strong ones are yellow signals. White colored signals are considered as the weakest signals.
Some minor fixes:
Some confusing words were thrown in the alarms section,
Added new alarm codes for any Triple or Double signals.
Major changes have been made with this update.
It is very important to know the direction and strength of the trend in financial markets. Therefore, ADX (Average Directional movement index) was developed by J. Welles Wilder in 1978 as an indicator of the trend strength in the prices of a financial instrument.
Especially in sideways markets, most indicators produce many false signals. However, these signals can be filtered with the ADX indicator. The price is considered sideways when the ADX is less than 20 as the threshold value.
With this update,
ADX filter can be activated when desired, and signals can be filtered flexibly according to the "threshold" value determined by the user. When the ADX filter is active, it will also reflect on the alarm conditions. Therefore, if an alarm is to be set according to the ADX filter, the filter must be activated first.
The colors of the lines and signals have been made changeable.
The visual level and thickness of the COL line has been made adjustable.
With this update, signals can be filtered according to the MavilimW indicator developed by @KivancOzbilgic
Filter Methods:
Normal: If the price is below the BlueW line, "bull" signals are filtered out, and above "bear" signals are filtered out.
Reverse : Applies the opposite of the normal method.
Fixed some visual bugs in switching between indicators.
ADA Gravity OscillatorThis indicator is a deviation of a Center of Gravity Oscillator corrected for the diminishing returns of Cardano (ADA).
I've set up this indicator for it to be used on the weekly timeframe . The indicator oscillates between 0 and 10, where 0 indicates oversold conditions and 10 indicates overbought conditions.
The indicator plots in any ADAUSD chart.
It paints in all time frames, but Weekly time frame is the correct one to interpret the 'official' read of it.
ETH Gravity OscillatorThis indicator is a deviation of a Center of Gravity Oscillator corrected for the diminishing returns of Ethereum.
I've set up this indicator for it to be used on the weekly timeframe . The indicator oscillates between 0 and 10, where 0 indicates oversold conditions and 10 indicates overbought conditions. What is interesting is that it is not particularly ideal for identifying market cycle tops, but generally picks out the most euphoric region in the initial parabolic rally. Good to potentially keep in mind if there is a second bounce to the peak!
The indicator plots in any ETH charts. It paints in all time frames, but Weekly time frame is the correct one to interpret the 'official' read of it.
Made at the request of a kind commenter. If you would like to request different derivations of this script be sure to let me know!
BTC Gravity OscillatorThis indicator is a deviation of a Center of Gravity Oscillator corrected for the diminishing returns of Bitcoin.
I've set up this indicator for it to be used on the weekly timeframe. The indicator oscillates between 0 and 10, where 0 indicates oversold conditions and 10 indicates overbought conditions.
The indicator plots in any BTCUSD spot, futures , BLX index and BTCEUR .
It paints in all time frames, but Weekly time frame is the correct one to interpret the 'official' read of it.
John F. Ehlers Center Of Gravity Balanced by [DM]Greetings to all colleagues.
I share this indicator turned into a strategy, (this is one of my first strategies so some inputs are missing and others are somewhat archaic)
this cog is formed by three signals which can be reduced by dividing by phi
Available settings:
Length setting for signal
Trigger parameter setting for strategy
stoploss settings
trailing stop settings
tp settings
I hope it fuels your curiosity
The Center of Gravity (COG) indicator is a technical indicator developed by John Ehlers in 2002, used to identify potential turning points in the price as early as possible. In fact, the creator John Ehlers claims zero lag to the price, and the smoothing effect of the indicator helps to spot turning points clearly and without distractions.
Ehlers Adaptive Center Of Gravity [CC]The Adaptive Center Of Gravity was created by John Ehlers and this is a regular center of gravity indicator combined to be use with the current cycle period. If you are not familiar with stock cycles then I would highly recommend his book on the subject: Cycle Analytics. Buy when the indicator turns green and sell when it turns red.
Let me know if there are any other indicators you want me to publish!
[blackcat] L2 Ehlers Center of GravityLevel: 2
Background
John F. Ehlers introuced center of gravity (CG) in his "Cybernetic Analysis for Stocks and Futures" chapter 5 on 2004.
Function
The center of gravity (CG) of a physical object is its balance point. For example, if you balance a 12-inch ruler on your finger, the CG will be at its 6-inch point. If you change the weight distribution of the ruler by putting a paper clip on one end, then the balance point (i.e., the CG) shifts toward
the paper clip. Moving from the physical world to the trading world, we can substitute the prices over our window of observation for the units of weight along the ruler. Using this analogy, we see that the CG of the window moves to the right when prices increase sharply. Correspondingly, the CG of the window moves to the left when prices decrease.
The idea of computing the center of gravity of Dr. Ehlers arose from observing how the lags of various finite impulse response (FIR) filters vary according to
the relative amplitude of the filter coefficients. A simple moving average (SMA) is an FIR filter where all the filter coefficients have the same value (usually unity). As a result, the CG of the SMA is exactly in the center of the filter. A weighted moving average (WMA) is an FIR filter where the most recent price is weighted by the length of the filter, the next most recent price is weighted by the length of the filter less 1, and so on. The weighting terms are the filter coefficients. The filter coefficients of a WMA describe the outline of a triangle. It is well known that the CG of a triangle is located at one-third the length of the base of the triangle. In other words, the CG of the WMA has shifted to the right relative to the CG of an SMA of equal length, resulting in less lag. In all FIR filters, the sum of the product of the coefficients and prices must be divided by the sum of the coefficients so that the scale of the original prices is retained.
Key Signal
CG ---> CG fast line
CG (2) ---> CG slow line
Pros and Cons
100% John F. Ehlers definition translation of original work, even variable names are the same. This help readers who would like to use pine to read his book. If you had read his works, then you will be quite familiar with my code style.
Remarks
The 26th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
[NLX-L2] Fisher Stochastic Center of Gravity (v4)- Fisher Stochastic Center of Gravity-
This is Fisher's Stochastic Center of Gravity converted to pine v4 by blackcat. A very powerful entry indicator!
The original was published by DasanC & EmpiricalFX and it's a very interesting take on FSCG.
All the credit for the indicator goes to the authors and inventor of FSCG, this is just a mod to be used with my NLX Modular Trading Framework .
- How to Use -
1. Add a Trend Indicator like Trend Index MTF to your chart
2. Add " Fisher Stochastic Center of Gravity" Indicator to your Chart and select the Trend Index MTF with Type L1 in the Settings as Source
2. Add the Backtest to your Chart and select the FSCG Signal with Type L2 as Source
- Alerts for Automated Trading -
See my signature below for more information. Contact me for the Alert module.
Ehlers Center Of Gravity Oscillator [CC]The Center of Gravity Oscillator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 49) and this provides a pretty accurate way to see how the stock is trending. If the indicator stays above 0 then the stock is in a pretty strong uptrend and if it stays below 0 then the stock is in a pretty strong downtrend. Buy when the indicator changes from red to green and sell when it changes from green to red.
Let me know if you would like me to publish any other indicators or if you want something custom done!
[R&D] Moving CentroidThis script utilizes this concept. Instead of weighting by volume, it weights by amount of price action on every close price of the rolling window. I assume it can be used as an additional reference point for price mode and price antimode.
it is directly connected with Market (not volume) profile, or TPO charts.
The algorithm:
1) takes a rolling window of, for example, 50 data points of close prices:
2) for each of this closing prices, the algorithm will check how many bars touched this close price.
3) then: sum of datapoints * weights/sum of weights
Since the logic is implemented in pretty non-efficient way, the script sometimes can take time to make calculations. Moreover, it calculates the centroid taking into account only close prices, not every tick. of a given rolling window That's why it's still experimental.
Ehlers Fisher Stochastic Center Of Gravity [CC]The Fisher Stochastic Center Of Gravity Indicator was created by John Ehlers (Cybernetic Analysis For Stocks And Futures pg 95) and this is a combo cycle indicator mixed with a stochastic indicator. The idea is to capture the beginning of the cycle and ride it until the end. Buy when the indicator line is green and sell when it turns red.
This was a custom request so let me know if you would like to see me publish any other scripts or if you want something custom done!
Borsa İstanbul Correlation Analysis&Center of Gravity IndicatorFormula Used :
COG = SUM of closing prices Pn x (n+1) / Sum of closing prices Pn
[LunaOwl] Center of Gravity作品: 艾勒斯重心點 (Center of Gravity, CG)
Center of Gravity was developed by John Ehlers in 2002. The main purpose of the Center of Gravity indicator is to find possible reversal points as early as possible. Indicator has two series, the first is the CoG series, and the second is the signal line calculated by the five-period smoothed moving average. Cross representative indication of the direction. I coded this indicator according to the description of MT4, a little work.
重心點(Center of Gravity)是由約翰.艾勒斯在2002年開發的,這個指標的主要用途是儘早發現可能的反轉點。它有兩個部份,一個是重心點指標線,另一個是經過五期平滑移動平均線平滑過的信號線,它們的交叉結果代表方向。我按照MT4的說明編寫了這個小作品。
Parametric Corrective Linear Moving AveragesImpulse responses can fully describe their associated systems, for example a linearly weighted moving average (WMA) has a linearly decaying impulse response, therefore we can deduce that lag is reduced since recent values are the ones with the most weights, the Blackman moving average (or Blackman filter) has a bell shaped impulse response, that is mid term values are the ones with the most weights, we can deduce that such moving average is pretty smooth, the least squares moving average has negative weights, we can therefore deduce that it aim to heavily reduce lag, and so on. We could even estimate the lag of a moving average by looking at its impulse response (calculating the lag of a moving average is the aim of my next article with Pinescripters) .
Today a new moving average is presented, such moving average use a parametric rectified linear unit function as weighting function, we will see that such moving average can be used as a low lag moving average as well as a signal moving average, thus creating a moving average crossover system. Finally we will estimate the LSMA using the proposed moving average.
Correctivity And The Parametric Rectified Linear Unit Function
Lot of terms are used, each representing one thing, lets start with the easiest one,"corrective". In some of my posts i may have used the term "underweighting", which refer to the process of attributing negative weights to the input of a moving average, a corrective moving average is simply a moving average underweighting oldest values of the input, simply put most of the low lag moving averages you'll find are corrective. This term was used by Aistis Raudys in its paper "Optimal Negative Weight Moving Average for Stock Price Series Smoothing" and i felt like it was a more elegant term to use instead of "low-lag".
Now we will describe the parametric rectified linear unit function (PReLU), this function is the one used as weighting function and is not that complex. This function has two inputs, alpha , and x , in short if x is greater than 0, x remain unchanged, however if x is lower than 0, then the function output is alpha × x , if alpha is equal to 1 then the function is equivalent to an identity function, if alpha is equal to 0 then the function is equivalent to a rectified unit function.
PReLU is mostly used in neural network design as an activation function, i wont explain to you how neural networks works but remember that neural networks aim to mimic the neural networks in the brain, and the activation function mimic the process of neuron firing. Its a super interesting topic because activation functions regroup many functions that can be used for technical indicators, one example being the inverse fisher RSI who make use of the hyperbolic tangent function.
Finally the term parametric used here refer to the ability of the user to change the aspect of the weighting function thanks to certain settings, thinking about it, it isn't a common things for moving averages indicators to let the user modify the characteristics of the weighting function, an exception being the Arnaud Legoux moving average (ALMA) which weighting function is a gaussian function, the user can control the peak and width of the function.
The Indicator
The indicator has two moving averages displayed on the chart, a trigger moving average (in blue) and a signal moving average (in red), their crosses can generate signals. The length parameter control the filter length, with higher values of length filtering longer term price fluctuations.
The percentage of negative weights parameter aim to determine the percentage of negative weights in the weighting function, note that the signal moving average won't use the same amount and will use instead : 100 - Percentage , this allow to reverse the weighting function thus creating a more lagging output for signal. Note that this parameter is caped at 50, this is because values higher than 50 would make the trigger moving average become the signal moving average, in short it inverse the role of the moving averages, that is a percentage of 25 would be the same than 75.
In red the moving average using 25% of negative weights, in blue the same moving average using 14% percent of negative weights. In theory, more negative weights = less lag = more overshoots.
Here the trigger MA in blue has 0% of negative weights, the trigger MA in green has however 35% of negative weights, the difference in lag can be clearly seen. In the case where there is 0% of negative weights the trigger become a simple WMA while the signal one become a moving average with linearly increasing weights.
The corrective factor is the same as alpha in PReLU, and determine the steepness of the negative weights line, this parameter is constrained in a range of (0,1), lower values will create a less steep negative weights line, this parameter is extremely useful when we want to reduce overshoots, an example :
here the corrective factor is equal to 1 (so the weighting function is an identity function) and we use 45% of negative weights, this create lot of overshoots, however a corrective factor of 0.5 reduce them drastically :
Center Of Linearity
The impulse response of the signal moving average is inverse to the impulse response of the trigger moving average, if we where to show them together we would see that they would crosses at a point, denoted center of linearity, therefore the crosses of each moving averages correspond to the cross of the center of linearity oscillator and 0 of same period.
This is also true with the center of gravity oscillator, linear covariance oscillator and linear correlation oscillator. Of course the center of linearity oscillator is way more efficient than the proposed indicator, and if a moving average crossover system is required, then the wma/sma pair is equivalent and way more efficient, who would know that i would propose something with more efficient alternatives ? xD
Estimating A Least Squares Moving Average
I guess...yeah...but its not my fault you know !!! Its a linear weighting function ! What can i do about it ?
The least squares moving average is corrective, its weighting function is linearly decreasing and posses negative weights with an amount of negative weights inferior to 50%, now we only need to find the exact percentage amount of negative weights. How to do it ? Well its not complicated if we recall the estimation with the WMA/SMA combination.
So, an LSMA of period p is equal to : 3WMA(p) - 2SMA(p) , each coefficient of the combination can give us this percentage, that is 2/3*100 = 33.333 , so there are 33.33% percent of negative weights in the weighting function of the least squares moving average.
In blue the trigger moving average with percentage of negative values et to 33.33, and in green the lsma of both period 50.
Conclusion
Altho inefficient, the proposed moving averages remain extremely interesting. They make use of the PReLU function as weighting function and allow the user to have a more accurate control over the characteristics of the moving averages output such as lag and overshoot amount, such parameters could even be made adaptive.
We have also seen how to estimate the least squares moving average, we have seen that the lsma posses 33.333...% of negative weights in its weighting function, another useful information.
The lsma is always behind me, not letting me focus on cryptobot super profit indicators using massive amount of labels, its like each time i make an indicator, the lsma come back, like a jealous creature, she want the center of attention, but you know well that the proposed indicator is inefficient ! Inefficient elegance (effect of the meds) .
Thanks for reading !
Center Of Linearity - A More Efficient Alternative To Elhers CGIntroduction
The center of gravity oscillator (CG) is one of the oscillators presented in Elhers book "cybernetic analysis for stocks and futures". This oscillator can be described as a bandpass filter centered around 0, its simplicity is ridiculous yet this indicator managed to get a pretty great popularity, this might be due to Elhers saying that he has substantial advantages over conventional oscillators used in technical analysis.
Today i propose a more efficient estimation of the center of gravity oscillator, this estimation will only use one convolution, while the original and other estimations use 2. I will also explain everything about the center of gravity oscillator, because even if its name can be imposing its actually super easy to understand.
The Center Of Gravity Oscillator
The CG oscillator is a bandpass filter, in short it filter high frequencies components as well as low frequency ones, this is why the oscillator is both smooth (no high frequencies) as well as detrended (no low frequencies), and therefore the oscillator focus exclusively on the cycles.
Its calculation is simple, its just a linearly weighted moving average minus a simple moving average wma - sma , this is not what is showcased in its book, but the result is just the same, the only thing that change is the scale, this is why some estimates have a weird scale that is not centered around 0, the output is technically the same but the scale isn't, however the scale of an oscillator isn't a big deal as long as the oscillator is centered around 0 and we don't plan to use it as input for overlay indicators.
If you are familiar with moving averages you'll know that the wma is more reactive than the sma, this is because more recent values have higher weights, and since subtracting a low-pass filter with another one conserve the smoothness while removing low-frequency components, we end up with a bandpass filter, yay!
Why "Center" Of Gravity ?
Elhers explain the idea behind this title with a pretty blurry analogy, so i'll try to give a visual explanation, we said earlier that the center of gravity was simply : wma - sma, ok lets look at their respective impulse responses,
Those are basically the weights of each filters, also called filter coefficients, lets denote the coefficients of the wma as a and the coefficients of the moving average as b . So whats the meaning behind center of gravity ? We basically want to "center" the weights of the wma, this can be done with a - b
The coefficients of the wma are therefore centered around 0, but actually there is more to that than a simple title explanation, basically a - b = c , where c are the coefficients of the center of gravity bandpass filter, therefore if we where to apply convolution to the price with c , we would get the center of gravity oscillator. Thats the thing with FIR filters, we can use convolution for describing a lot of FIR systems, and the difference between two impulse responses of two low-pass filters (here wma, sma) give us the coefficients of a bandpass filter.
The Center Of Linearity
At this point we could simply get the oscillator by using length/2 - i as coefficient, however in order to propose a more interesting variation i decided to go with a less efficient but more original approach, the center of linearity. Imagine two convolutions :
a = i*src and b = i*src
a only has a reversed index length-i , and is therefore describe a simple wma. Both convolutions give the following impulse responses :
Both are symmetrical to each others, and cross at a point, denoted center of linearity. The difference of each responses is :
Using it as coefficients would give us a bandpass filter who would look exactly like the Cg oscillator, this would be calculated as follows in our convolution :
i*src -i*src ) = i*(src -src )
Lets compare our estimate with the CG oscillator,
Conclusion
I this post i explained the calculation of the CG oscillator and proposed an efficient estimation of it by using an original approach. The CG oscillator isn't something complicated to use nor calculate, and is in fact closely related to the rolling covariance between the price and a linear function, so if you want to use the crosses between the center of gravity and 0 you can just use : correlation(close,bar_index,length) instead, thats basically the same.
The proposed indicator can also use other weightings instead of a linear one, each impulses responses would remain symmetrical.
CoG SSL BF 🚀In this strategy I combine my Center of Gravity script with my SSL Channel script.
The conditions for a long signal are if either:
Center of Gravity long is satisfied
Or
SSL Channel long is satisfied AND we are not in a sideways period.
The conditions for a short signal are if either:
Center of Gravity short is satisfied
Or
SSL Channel short is satisfied AND we are not in a sideways period.
We use a dynamic stop loss based on ATR to determine optimum stop loss levels. These levels are printed on the chart in yellow and orange.
INSTRUCTIONS
Bright green background = go long
Bright red background = go short
Yellow dotted line = long stop loss
Orange dotted line = short stop loss
On the chart, the 2 outer lines are the Center of Gravity lines and the filled channel in the middle is the SSL channel.
If the channel is white, this is a no trade zone, unless either Center of Gravity long/short signal is satisfied.
If we get stopped out from a long and we still have a long condition present, we re-enter. Same for short.
Center of Gravity BF 🚀Thanks to HPotter for the code I based this strategy on.
Center of Gravity calculation is based here on a linear regression function using the least squares method.
We use this to calculate a channel consisting of 2 lines, green and red on the chart
This strategy employs a dynamic stop loss function that measures stop loss placement based on recent ATR.
How signals are generated:
Price closes above green line = Go Long
Price closes below red line = Go Short
Yellow dotted line = stop loss based on long entry
Orange dotted line = stop loss based on short entry
INSTRUCTIONS
Green background = Go Long, put your stop loss at the yellow dotted line
Red background = Go Short, put your stop loss at the orange dotted line
NB: The stop losses printed on the chart are calculated from the point of entry on a trade, if you make a different entry to what is indicated, the corresponding stop loss will be different to what the indicator displays.
Center of Gravity Oscillator - Ehlers by KIVANC fr3762Center of Gravity OSCILLATOR by JOHN EHLERS
Converted the original code from his book "Cybernetic Analysis for Stocks and Futures"
This article describes a new oscillator that is unique because it is both smoothed
and has essentially zero lag. The smoothing enables clear identification of turning
points and the zero lag aspect enables action to be taken early in the move. This
oscillator is the serendipitous result of my research into adaptive filters. While the filters
have not yet produced the result I seek, this oscillator has substantial advantages over
conventional oscillators used in technical analysis . The “CG” in the name of the
oscillator stands for the Center of Gravity of the prices over the window of observation.
The Center of Gravity ( CG ) of a physical object is its balance point. For example,
if you balance a 12 inch ruler on your finger, the CG will be at its 6 inch point. If you
change the weight distribution of the ruler by putting a paper clip on one end, then the
balance point (e.g. the CG ) shifts toward the paper clip. Moving from the physical world
to the trading world, we can substitute the prices over our window of observation for the
units of weight along the ruler. With this analogy, we see that the CG of the window
moves to the right when prices increase sharply. Correspondingly, the CG of the
window moves to the left when prices decrease.
For further information:
www.mesasoftware.com
Here's the link to a complete list of all my indicators:
t.co
Şimdiye kadar paylaştığım indikatörlerin tam listesi için: t.co
Combo Backtest 123 Reversal & Center Of Gravity This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The indicator is based on moving averages. On the basis of these, the
"center" of the price is calculated, and price channels are also constructed,
which act as corridors for the asset quotations.
WARNING:
- For purpose educate only
- This script to change bars colors.
Combo Strategy 123 Reversal & Center Of Gravity This is combo strategies for get a cumulative signal.
First strategy
This System was created from the Book "How I Tripled My Money In The
Futures Market" by Ulf Jensen, Page 183. This is reverse type of strategies.
The strategy buys at market, if close price is higher than the previous close
during 2 days and the meaning of 9-days Stochastic Slow Oscillator is lower than 50.
The strategy sells at market, if close price is lower than the previous close price
during 2 days and the meaning of 9-days Stochastic Fast Oscillator is higher than 50.
Second strategy
The indicator is based on moving averages. On the basis of these, the
"center" of the price is calculated, and price channels are also constructed,
which act as corridors for the asset quotations.
WARNING:
- For purpose educate only
- This script to change bars colors.