Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

How to use the formula expression? Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
yx25606
Posted : Sunday, April 15, 2018 12:22:13 PM
Registered User
Joined: 10/5/2016
Posts: 71

Y=SMA(X,N,M) ≠avg(x,n)

 Y=(M*X+(N-M)*Y')/N

How to use the formula expression?How to have values from the first day?
 

 

 
yx25606
Posted : Sunday, April 15, 2018 12:24:57 PM
Registered User
Joined: 10/5/2016
Posts: 71
Y=SMA(X,N,M) Is not equal to avg(x,n) 

 Y=(M*X+(N-M)*Y')/N

How to use the formula expression?How to have values from the first day?

 

Bruce_L
Posted : Monday, April 16, 2018 12:31:17 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
yx25606
Posted : Monday, April 16, 2018 1:36:25 PM
Registered User
Joined: 10/5/2016
Posts: 71

Thank you!

XAVG(c,2*(10-1))?Can't seem to pass。

5 days average numerical, must start from the fifth day is in front of the four days?
 

 

Bruce_L
Posted : Monday, April 16, 2018 1:41:23 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
yx25606
Posted : Monday, April 16, 2018 2:45:57 PM
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?
 
Bruce_L
Posted : Monday, April 16, 2018 2:53:44 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
yx25606
Posted : Monday, April 16, 2018 3:16:08 PM
Registered User
Joined: 10/5/2016
Posts: 71
May line has a problem, I again hair once, figure can see?
 
 
Bruce_L
Posted : Monday, April 16, 2018 3:35:40 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
yx25606
Posted : Monday, April 16, 2018 4:03:34 PM
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.

Bruce_L
Posted : Monday, April 16, 2018 4:15:56 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

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
yx25606
Posted : Monday, April 16, 2018 11:00:12 PM
Registered User
Joined: 10/5/2016
Posts: 71
Delayed so much of your time, thank you very much!
 
Bruce_L
Posted : Tuesday, April 17, 2018 9:22:32 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.