Coding and using Center of Gravity Indicator in PineScript

 Center of Gravity is a oscillator type of indicator. It is formed by mean of weighted moving averages. It has lesser lag than other moving average indicators. A Center of Gravity indicator can be used for 

1. Generating buy sell signals

2. Marking support and resistance zones

3. Finding possibility of turning point through divergence.

How to use Center of Gravity Indicator

Method 1 : Any momentum or oscillator type of indicator can be used by creating a signal line by taking average of indicator value. Say, if I create a Centre of Gravity indicator with 10 periods than I can take a 3 or 5 days average of the indicator value to create a more smooth line to act as a signal line. 

Below is the code for creating COG with 10 period and signal line with 5 period.

//@version=4
study("implementing COG indicator")
cog_value = cog(close,10)
cog_avg =sma(cog_value,5)
plot(cog_value)
plot(cog_avg,color=color.red)

Here is the output generated by the code. You can always adjust the value of signal line to suit your requirement and better identification of buy/sell signals.

Method 2 : 
Use Divergence between COG and price as a signal for change of trend
Method 3 : Use RSI along with COG to filter signals.

Resources

Learn more on COG, coding and other technical indicators in PineScript through Books on pinescript available on amazon and kindle.


200+ pages book100 pages book

Buy Udemy Course on creating trading strategies and creating indicators in PINESCRIPT on trading view at 70% discounted price at USD 20. Buy Now  

Resources

Highest Rated Udemy Course on PineScript - Grab your Seat Now 

Udemy Discount Coupon Code : UDEMY-JAN23 (Valid upto 30th Nov 2023)

Learn more about coding on tradingview in PineScript through Books on pinescript available on amazon and kindle.


200+ pages book100 pages book200+ pages book


Point and Figure Charts : A Time-Tested Tool for Technical Analysis

In the dynamic world of financial markets, investors and traders constantly seek tools that can provide valuable insights into market trends...