Center Of Gravity
The Center Of Gravity (COG) is calculated from the sum of prices over a user defined period. A signal line which is an moving average of the COG is also plotted. Adjustable guides are shown to fine tune the signals. The user may change the input (close), method (EMA), period lengths and guide values. This indicator’s definition is further expressed in the condensed code given in the calculation below.
How To Trade Using Center Of Gravity
Adjust the top and bottom guides to control the quantity and quality of the trading signals. If the COG is above the top guide and crosses below the signal line a sell signal is generated. Conversely, if the COG is below the bottom guide and crosses above the signal line a buy signal will be given.
How To Access in MotiveWave
Go to the top menu, choose Study>Oscillators>Center Of Gravity Index
or go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.
Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.
Calculation
//input = price, user defined, default is closing price
//method = moving average, user defined, default is EMA
//cogPeriod = user defined default is 10
//sigPeriod = user defined default is 5
//sumNum = sumNumerator
//sumDen = sumDenomator
//MT = moreThan, LT = lessThan
//index = current bar number
x = 0;
for (i = index-cogPeriod+1; i++)
iprice = price[i];
sumNum = sumNum + (iprice * (x + 1));
sumDen = sumDen + iprice;
x++;
end;
cog = 100 * sumNum / sumDen;
sig = ma(index, method, sigPeriod, cog);
//Signals
sell = crossedBelow(cog, sig) AND cog MT topGuide AND (cog MT highSell);
buy = crossedAbove(cog, sig) AND cog LT bottGuide AND (cog LT lowBuy);