I am trying to write the code for John Ehler's CG Osc. It's my first indicator in NinjaScript, I thought I did this right...but (I obviously didn't) it's just drawing a flat zero line.
here's my code:
double num = 0;
double den = 0;
double cog = 0;
for (int barsAgo = 0; barsAgo = Period; barsAgo++)
{
num = (num + Input[barsAgo]) * (barsAgo + 1);
den = num + Input[barsAgo];
}
cog = -1 * (num/dem) ;
CGL.Set(cog);
SL.Set(cog[-1]);
// HL.Set(Close[0]);

Comment