Help with writing a new moving average

 

Hello,

I am very new here  and want to practice a bit in coding. I decided to write a moving average.

Writing from scratch is hard so I pull up an ema script people writes.

There is this line


inpPrice = PRICE_CLOSE

_ema.calculate()

getPrice(inpPrice,open,high,low,close,i)


I would like to know what 

_ema.calculate()

getPrice()

do, why don't we just use open high low and close themselves to calculate?


Let say I want to manipulate the open high low and close before feeding into the moving average function, can I just change the arguments in getPrice(inpPrice,open,high,low,close,i)?

Here is the ema code I found online:

https://www.mql5.com/en/code/25047

Exponential moving average
Exponential moving average
  • www.mql5.com
In the "back to basic" again : Even though EMA is fairly simple and the code execution time should not vary a lot from one version to another (EMA does not have loops within the loops), it seems that we are still lacking some easy to reuse code that is fast in execution also. This version fills that a bit PS: using the alternative mode of...
Reason: