Center Of Gravity Oscillator free

by qualitiedx2 in category Trend at 17/02/2012
Description

COG is an oscillator based on an article by John F. Ehlers on page 20 of the May 2002 issue of Stocks and Commodities Magazine. COG has essentially zero lag and enables clear identification of turning points.

Center of Gravity

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgocTrader
using System;
using cAlgo.API;
using cAlgo.API.Indicators;

namespace cAlgo.Indicators
{
    [Indicator(IsOverlay = false, AccessRights = AccessRights.None)]
    public class COGOsci : Indicator	//John Ehler's
    {
        [Output("CoG",Color=Colors.Red)]
        public IndicatorDataSeries cg { get; set; }

		[Output("Lag",Color=Colors.Blue)]
        public IndicatorDataSeries lag { get; set; }
		
        [Parameter(DefaultValue = 10)]
        public int Length { get; set; }

		private IndicatorDataSeries input;
	
		protected override void Initialize()
        {
        	input = CreateDataSeries();
		}
		
        public override void Calculate(int index)
        {
            if(index<Length+1)
            {
            	return;
            }
            input[index] = (MarketSeries.High[index]+MarketSeries.Low[index])/2;
           	double Num=0;
            double Denom=0;
            for(int i=0;i<Length;i++)
            {
            	Num += (1+i)*input[index-i];
            	Denom += input[index-i];
            }
            if(Denom!=0)
            {
            	cg[index]= -Num/Denom + (Length+1)/2;
            }
            lag[index]=cg[index-1];
        }
    }
}
Comments

oceanpearl553 - December 27, 2022 @ 09:27

Our dissertation writing service writers are immensely interested in cultivating maximum success for your academic growth. We strive our best to eliminate every academic struggle that a student goes through in their career. To serve the purpose, we offer real specialists for homework help that will grab the attention of your professor and retain it until he has completely read the dissertation. Our domain specialist writers make this possible by writing flawless homework by scrupulously carrying our research and ensuring that the prepared homework is knowledge-rich. Moreover, the enlightened writers at dissertation writing help are extremely competent with their job. They hold boundless knowledge and experience in homework making to make sure that the dissertation is a pure reflection of perfection and what your instructor wants! We want all of our clients to be a paragon of excellence by standing tallest among their classmates. Tell our dissertation service specialists to "do my dissertation now", and take a seat back. The specialists are punctilious who will read out the brief thoroughly and start working as per the instructions.

5