Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 7/23/2016 Posts: 19
|
Hi Bruce, I am currently reading through all the posts in this forum to try and learn the code. I came across this code below. How could the code below be adapted so price is within 50 cents of the 50sma (50 cents above and 50 Cents below) rather than using a percentage of.
A condition formula for the current price being within 3% of the 50 period simple moving average can be written as follows.
100 * (C / AVGC50 - 1) <= 3
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following instead.
ABS(C - AVGC50) <= .5
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2016 Posts: 19
|
Thanks Bruce. If I wanted to use expotential moving average instead. Is the code below correct.
ABS(C - xAVGC50) <= .5
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, that would be correct for exponential moving average.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2016 Posts: 19
|
Thanks Bruce.
|
|
Registered User Joined: 7/23/2016 Posts: 19
|
Hi Bruce, If I used this code ABS(C-XAVG50) <=.5. Would it be possible to add additional code so the 50 Expotential Moving Average is sloping higher or lower. Ideally I would like the 50EMA to be at a 30-45 degree angle, if this isnt possible please can you suggest the best alternative.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You can check for the 50EMA to be going up or down, but it isn't possible to check for a specific angle. This is because the angle in degrees in dependent on things such as scroll, zoom, the aspect ratio of the chart and even what other indicators are plotted in the same pane.
Going Up:
ABS(C - XAVGC50) <= .5 AND C > XAVGC50
Going Down:
ABS(C - XAVGC50) <= .5 AND C < XAVGC50
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2016 Posts: 19
|
Thanks Bruce you are a Legend.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |