Registered User Joined: 10/5/2016 Posts: 71

Y=SMA(X,N,M) ≠avg(x,n)
Y=(M*X+(NM)*Y')/N
How to use the formula expression？How to have values from the first day?


Registered User Joined: 10/5/2016 Posts: 71

Y=SMA(X,N,M) Is not equal to avg(x,n)
Y=(M*X+(NM)*Y')/N
How to use the formula expression？How to have values from the first day?


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

If Y' is the previous value of the moving average, X is whatever is being averaged, M = 1, and N is the period of the moving average, then you can use the following (this is Wilder's smoothing which is a type of exponential moving average).
XAVG(X, P)
Where P = (2 * N)  1
If Y' is the previous value of the moving average, X is whatever is being averaged, M = 2 AND N is the period of the moving average plus one, then you can use the following (this is a normal exponential moving average average).
XAVG(X, P)
Where P is the period of the moving average.
The moving average is calculated entirely from the values on the chart, so it will not start plotting until the algoritm being used has finished initializing.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/5/2016 Posts: 71

Thank you！
XAVG(c,2*(101))?Can't seem to pass。
5 days average numerical, must start from the fifth day is in front of the four days?


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

The second argument has to be an numeric integer and can't be a formula. So you have to write it as follows (and it would be ((2 * 10  1) and not (2 * (10  1)) as far as the value to use goes.
XAVG(C, 19)
Or as:
XAVGC19
You are going to have four or five blank spaces before the moving average starts plotting if the period used is 5. So in the case of the above, you would have 18 or 19 blank spaces before the moving average starts plotting.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/5/2016 Posts: 71

Thank you！
Understand, but the problem was not solved, can have a look at the breakthrough in the sent to your email? No function can be done?


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

I think I am just not understanding what you are saying. It looks like we already replied to the only email we received from you on the subject.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/5/2016 Posts: 71

May line has a problem, I again hair once, figure can see?


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

I have poured over the email along with each of the three attachments and I have no other ideas as to what is being asked (several other people have looked at it as well to try and brainshtorm about what you are asking).
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/5/2016 Posts: 71

Basic like this, don't do the first day there will be an average value。Thank you very much！
You are going to have four or five blank spaces before the moving average starts plotting if the period used is 5. So in the case of the above, you would have 18 or 19 blank spaces before the moving average starts plotting.


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

Just guessing again, but the Personal Criteria Formula Language doesn't have a way to reference the previously calculated value in a formula. So while you can use a Custom PCF Cumulative Indicator which can add or subtract a calculation from a running total, there is no way to reference the previous value of the running total to use in the calculations.
There also isn't a way to use nested IIF() functions in order to test how many bars of data are available and then use different calculations based on the number of bars. The moment you get to a test which asks for a number of bars exceeding the number of available bars, the IIF() function will return an error instead of returning the true or false result.
Say you are trying to return a 5 period simple moving average of C with the data series starting on the first bar. You can't just return C for the first bar, (C + C1) / 2 for the second bar (C + C1 + C2) / 3 for the third bar, (C + C1 + C2 + C3) / 4 for the fourth bar, and (C + C1 + C2 + C3 + C4) / 5 for all of the rest of the bars. The concept is sound, but there isn't a way to implement it in the Personal Criteria Formula Language.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/5/2016 Posts: 71

Delayed so much of your time, thank you very much！


Worden Trainer
Joined: 10/7/2004 Posts: 64,305

You're welcome.
Bruce Personal Criteria Formulas TC2000 Support Articles


Guest1 