Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Scanning a finite number of bars for a condition Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
techohio
Posted : Tuesday, September 22, 2015 3:56:34 PM
Platinum Customer Platinum Customer

Joined: 3/5/2006
Posts: 55

Hello,

I need to scan a personal watchlist of 100 symbols to search the last 30 daily bars in each stock for a condition (High > Prior Close), and present the resulting subset list of symbols along with the high of the respective bar (whether it occurred 3 bars ago or 10 bars ago).

Could someone help me with how to accomplish this?

Bruce_L
Posted : Tuesday, September 22, 2015 4:50:25 PM


Worden Trainer

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

The first part is fairly easy. Create a Custom PCF % True Indicator with H > C1 as the Formula. Set the Period to 30 and the Average Type to Simple. Then click on it and select Create Scan Condition to create a condition for the value of the Custom PCF % True Indicator being greater than 0.

Condition True at Least Once Over x Bars

You use this as an EasyScan Condition in an EasyScan set to use your personal WatchList of 100 symbols as the List to Scan and the only symbols returned will be those where the high was greater than the prior close at least once during teh most recent 30 bars.

Building a Scan with Multiple Conditions (7:29)

Getting a WatchList Column to return the number of bars ago for which the high was most recently greater than the previous close is a bit more complicated. We will need to use the techniques given in the Days Since Last Peak (or other day-counting needs) topic for this.

This results in using the following Indicator Formula as a WatchList Column in our EasyScan.

ABS(H <= C1) * (ABS(H1 > C2) + ABS(H1 <= C2) * (ABS(H2 > C3) * 2 + ABS(H2 <= C3) * (ABS(H3 > C4) * 3 + ABS(H3 <= C4) * (ABS(H4 > C5) * 4 + ABS(H4 <= C5) * (ABS(H5 > C6) * 5 + ABS(H5 <= C6) * (ABS(H6 > C7) * 6 + ABS(H6 <= C7) * (ABS(H7 > C8) * 7 + ABS(H7 <= C8) * (ABS(H8 > C9) * 8 + ABS(H8 <= C9) * (ABS(H9 > C10) * 9 + ABS(H9 <= C10) * (ABS(H10 > C11) * 10 + ABS(H10 <= C11) * (ABS(H11 > C12) * 11 + ABS(H11 <= C12) * (ABS(H12 > C13) * 12 + ABS(H12 <= C13) * (ABS(H13 > C14) * 13 + ABS(H13 <= C14) * (ABS(H14 > C15) * 14 + ABS(H14 <= C15) * (ABS(H15 > C16) * 15 + ABS(H15 <= C16) * (ABS(H16 > C17) * 16 + ABS(H16 <= C17) * (ABS(H17 > C18) * 17 + ABS(H17 <= C18) * (ABS(H18 > C19) * 18 + ABS(H18 <= C19) * (ABS(H19 > C20) * 19 + ABS(H19 <= C20) * (ABS(H20 > C21) * 20 + ABS(H20 <= C21) * (ABS(H21 > C22) * 21 + ABS(H21 <= C22) * (ABS(H22 > C23) * 22 + ABS(H22 <= C23) * (ABS(H23 > C24) * 23 + ABS(H23 <= C24) * (ABS(H24 > C25) * 24 + ABS(H24 <= C25) * (ABS(H25 > C26) * 25 + ABS(H25 <= C26) * (ABS(H26 > C27) * 26 + ABS(H26 <= C27) * (ABS(H27 > C28) * 27 + ABS(H27 <= C28) * (ABS(H28 > C29) * 28 + ABS(H28 <= C29) * (ABS(H29 > C30) * 29)))))))))))))))))))))))))))))

You may want to set the Label setting of the Custom PCF Indicator to something besides being blank as this will make it easier to edit when used as a WatchList Column.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
techohio
Posted : Wednesday, September 23, 2015 11:11:58 AM
Platinum Customer Platinum Customer

Joined: 3/5/2006
Posts: 55

When you said to set the "Average Type to 30", the only choices I see for Average Type are Simple, Exponential or Front Weighted?

I will need to sit with this for a bit before I try it. 

techohio
Posted : Wednesday, September 23, 2015 11:13:49 AM
Platinum Customer Platinum Customer

Joined: 3/5/2006
Posts: 55

Oh.. and does the complexity of this formula have any implications on how fast it will run (this is all run on TC2000 servers vs my local computer, is that right?)

 

Bruce_L
Posted : Wednesday, September 23, 2015 12:10:01 PM


Worden Trainer

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

The Average Type needs to be set to Simple.

Yes, the complexity of this formula will affect its speed and the minimum refresh rate which can be set for the WatchList Column.



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