Deposit to your account via Visa QIWI Wallet
529
2014.07.30 18:46

Is there a way to add the new close, of a period, to the sum of previous period(s) closes?  So that I can divide by the number of periods, to find the average close value?

Thanks!

3243
2014.07.30 20:05

i don't understand your question can you please provide an example or at least more details

but one thing for sure

in this century everything is possible

Moderator
7986
2014.07.30 20:41
Yellowbeard:

Is there a way to add the new close, of a period, to the sum of previous period(s) closes?  So that I can divide by the number of periods, to find the average close value?

Thanks!

You mean a moving average?
529
2014.07.30 20:57

On a 5 minute chart, each period / candle equals 5 minutes.  Within each five minute period, there is a close, that is established.  What I wish to accomplish is, to add the closes of each period, then divide by the number of periods to find the average close value of a set number of periods.  I can establish a past close value by assigning the current close value to another variable.    For example PastVal = CurrVal, inserted in my EA, just after, int start().  This allows me to add the previous close value of period one to the current close value of period two, creating a sum of both.   My problem is when I need to add the close value of period three.  I'm only getting the sum of period two and period three, instead of the sum of one, two and three.  Need to be able to create a sum of the past and current close values, which also, allows me to keep adding the next period's close value to it.  Then I can divide this value by the number of periods to find the average.

Hope this clarifies what I'm trying to accomplish.

Thanks!

13641
2014.07.31 01:46
 Yellowbeard: to find the average. Why don't you just use iMA()?
/