Quote:
|
Originally Posted by forexts
http://www.forex-tsd.com/showpost.ph...0&postcount=23
I think this oscillator (documented in Ehlers section), is a very good exercise for this section.
In fact I think we could develop as much indicators from Ehlers as possible.
Figure 1. Easy Language Code to Compute the CG Oscillator
Inputs: Price((H+L)/2),
Length(10);
Vars: count(0),
Num(0),
Denom(0),
CG(0);
Num = 0;
Denom = 0;
For count = 0 to Length - 1 begin
Num = Num + (1 + count)*(Price[count]);
Denom = Denom + (Price[count]);
End;
If Denom <> 0 then CG = -Num/Denom;
Plot1(CG, "CG");
Plot2(CG[1], "CG1");
|
Forexts,
Thank you very much for your suggestion; it's really a very good exercise.
It will be our next lesson.
At the same time the Oscillator's name starts with my name's first letters CG (Center of Gravity) (Coders' Guru) 