Please edit your post . . . .
Before posting please read some of the other threads . . . then you would have seen numerous requests like this one:
Please use this to post code . . . it makes it easier to read.sunnybeach:
I need to implement the original code for:
PriceBasic = iMA(NULL,PERIOD_M30, BasePeriod,0,MODE_SMMA, PRICE_CLOSE, 1);
Isn't this all you need ?
sumN1 = 0.0; for(ij = BasePeriod; ij >= 1; ij--) sumN1 = sumN1 + Close[ij]; SMMA1 = sumN1/BasePeriod; // <--- this is the MA
RaptorUK:
Isn't this all you need ?
SMMA1 = sumN1/BasePeriod
- Sorry RaptorUK That is SMA not SMMA
- Note that SMMA( L ) = EMA( 2L-1 ) See here
- sunnyBeach, if you want to implement SMMA, see the above link, or implement the easier EMA. The question is why. You have iMA() and iMAOnArray() both do what you want, why reinvent the wheel?
WHRoeder:
- Sorry RaptorUK That is SMA not SMMA
1. Ah . . . it's mostly Greek to me :-)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I need to implement the original code for:
PriceBasic = iMA(NULL,PERIOD_M30, BasePeriod,0,MODE_SMMA, PRICE_CLOSE, 1);
I code as following:
sumN1 = 0.0;
for(ij = BasePeriod; ij >= 1; ij--)
sumN1 = sumN1 + Close[ij];
SMMA1 = sumN1/BasePeriod;
TDIBasic1 = (sumN1 - SMMA1 + Close[1])/BasePeriod;
But I get the wrong result and I get blocked, is there something wrong?