NexusFi: Find Your Edge


Home Menu

 





Center of Gravity by John Ehlers


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Big Mike with 4 posts (0 thanks)
    2. looks_two eleven with 2 posts (12 thanks)
    3. looks_3 Silvester17 with 2 posts (0 thanks)
    4. looks_4 wh with 1 posts (0 thanks)
    1. trending_up 21,464 views
    2. thumb_up 17 thanks given
    3. group 5 followers
    1. forum 10 posts
    2. attach_file 5 attachments




 
Search this Thread

Center of Gravity by John Ehlers

  #11 (permalink)
 CambriaJohn 
San Luis Obispo, CA USA
 
Experience: Master
Platform: TradeStation
Trading: ES
Posts: 1 since Jul 2013
Thanks Given: 0
Thanks Received: 1

The Center of Gravity indicator topic came up during my webinar last week, and I did a poor job of explaining it. My COG indicator does not change over history. Once it is computed, that value is "sticky". Perhaps an analogy of a teeter-totter is best used to understand it. Rising prices drive the balance point up, and falling prices drive the balance point down. The center of gravity is the balance point of the teeter-totter. Here is the EasyLanguage code in case something has been lost in translation over the years: (don't forget that EasyLanguage uses the argument of the Cosine in degrees. You need to convert 360 to 2*Pi in other languages.
John Ehlers

Inputs:
Length(10);

Vars:
alpha1(0),
HP(0),
a1(0),
b1(0),
c1(0),
c2(0),
c3(0),
Filt(0),
HighestC(0),
LowestC(0),
count(0),
Num(0),
Denom(0),
CG(0);

//Highpass filter cyclic components whose periods are shorter than 48 bars
alpha1 = (Cosine(.707*360 / 48) + Sine (.707*360 / 48) - 1) / Cosine(.707*360 / 48);
HP = (1 - alpha1 / 2)*(1 - alpha1 / 2)*(Close - 2*Close[1] + Close[2]) + 2*(1 - alpha1)*HP[1] - (1 - alpha1)*(1 - alpha1)*HP[2];
//Smooth with a Super Smoother Filter from equation 3-3
a1 = expvalue(-1.414*3.14159 / Length);
b1 = 2*a1*Cosine(1.414*180 / Length);
c2 = b1;
c3 = -a1*a1;
c1 = 1 - c2 - c3;
Filt = c1*(Close + Close[1]) / 2 + c2*Filt[1] + c3*Filt[2];

Num = 0;
Denom = 0;
For count = 0 to Length - 1 begin
Num = Num + (1 + count)*(Filt[count]);
Denom = Denom + (Filt[count]);
End;
If Denom <> 0 then CG = -Num/Denom + Length / 2 + .5;

Plot1(CG, "CG");
Plot2(0);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Quantum physics & Trading dynamics
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
Better Renko Gaps
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
26 thanks
ApexTraderFunding.com experience and review
13 thanks
Trading with Intuition
12 thanks
EG Indicators
11 thanks
What is Markets Chat (markets.chat) real-time trading ro …
9 thanks




Last Updated on June 9, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts