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

Moving Averages in gear x % of the time Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
Chagall
Posted : Sunday, September 24, 2017 4:59:59 PM
Registered User
Joined: 9/11/2012
Posts: 92
Bruce,
 
I would like to scan for symbols matching the following conditions:
 
Within the last x bars, in an uptrend, a shorter sma "y" should be greater than a longer sma "z" in "p" percent of the bars. Example: During the last 100 bars, the sma 50 is above the sma 100 in 80% of the cases (bars).
 
Of couse I would try, with this kind of condition, to look for sort of continuing uptrend, including the many unevitable deviations.
Do you think there is a way to write this as an TC2000 formula?
 
thank you,
 
Franz J.
diceman
Posted : Sunday, September 24, 2017 6:34:55 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

This should do what you want:

 

SUM(IIF(AVGC50>AVGC100,1,0),100)

 

 

 

Thanks

 

Chagall
Posted : Tuesday, September 26, 2017 12:08:24 PM
Registered User
Joined: 9/11/2012
Posts: 92

Thanks, but it seems to me this is an indicator summing up the days with sma50>sma100 true, with that condition met every day (I may be wrong). What I am looking for is a scan, which can show which symbols met that condition in x % of the last z bars. Setting set formula = 1 as a condition, I don´t get the desired results.

Bruce_L
Posted : Tuesday, September 26, 2017 12:19:07 PM


Worden Trainer

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

This part of the formula returns 1 if AVGC50 > AVGC100 and 0 otherwise.

IIF(AVGC50>AVGC100,1,0)

The SUM(w, 100) portion adds together these values over the most recent 100 bars.

So you are correct that this is a count of the number of bars where AVGC50>AVGC100.

The key to this being a percent is that the count is over 100 bars. If it were for a different number of bars, the formula would be more complicated, although only slightly. For example:

100 * SUM(IIF(AVGC50 > AVGC150, 1, 0), 59) / 59

Would return the percentage of bars where AVGC50 > AVGC150 over the most recent 59 bars.

Checking for this to be at least 10% would be:

100 * SUM(IIF(AVGC50 > AVGC150, 1, 0), 59) / 59 >= 10



-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.