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

50 Cents to 50 SMA Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
StockOperator2016
Posted : Friday, April 27, 2018 8:31:26 AM
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

Bruce_L
Posted : Friday, April 27, 2018 8:34:02 AM


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
StockOperator2016
Posted : Friday, April 27, 2018 8:51:48 AM
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

 

 

Bruce_L
Posted : Friday, April 27, 2018 9:06:01 AM


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
StockOperator2016
Posted : Friday, April 27, 2018 1:10:17 PM
Registered User
Joined: 7/23/2016
Posts: 19

Thanks Bruce.

StockOperator2016
Posted : Thursday, May 3, 2018 5:56:22 AM
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.

Bruce_L
Posted : Thursday, May 3, 2018 8:54:29 AM


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
StockOperator2016
Posted : Friday, May 4, 2018 7:58:40 AM
Registered User
Joined: 7/23/2016
Posts: 19

Thanks Bruce you are a Legend.

Bruce_L
Posted : Friday, May 4, 2018 10:37:54 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.