Central Moving Average - page 2

 

...

rashygomez:
Do all LA'ers have this sense of humour?

Just me:).................

 

"the CMA is just the SMA shifted by a certain number of days."

If I understand this articlecorrectly then it shouldn't be a problem to place a number of moving averages on a chart, shifted by a number of bars each time.

 

It was just an idea based on this ...

int start()

{

for(int iteration = 0; iteration < Bars -1; iteration ++)

{

for(int number.of.periods = 0; number.of.periods < MA.period; number.of.periods ++)

{

sum = sum + iMA(NULL, 0, MA.period, 3, MODE_SMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 6, MODE_SMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 5, MODE_SMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 3, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 21, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 46, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 67, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 74, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 67, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 46, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 21, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 3, MODE_LWMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 5, MODE_SMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 6, MODE_SMA, PRICE_CLOSE, 0);

sum = sum + iMA(NULL, 0, MA.period, 3, MODE_SMA, PRICE_CLOSE, 0);

MA.line[number.of.periods] = sum;

}

// Print("Sum ", sum);

sum = 0;

}

}

 
 

You know, I've looked at the mql code and it's wonderfully presented and coded - absolutely brilliant stuff. Thank you for being around the forum, mladen - genius.

 

Which didn't work out.

 

Sadly

This is a Spencers moving average coded as the link you provided (this link : Spencer's 15-Point Moving Average -- from Wolfram MathWorld )
PS: it is centered moving average (centered moving averages, as you already have posted it, use future values in their calculations) and as all centered moving averages, last half bars can change. In this one it means that last 8 bars are subject of change

regards

Mladen

 

Nice work Mladen

 

hi mladen

thank you for sharing the ma

best regards

 

this ma repaints? redraw?

Reason: