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 |

Count number of signals Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
busterram
Posted : Friday, April 17, 2015 3:08:07 PM
Registered User
Joined: 10/9/2011
Posts: 485

Good afternoon. I was wondering if there is a way to count how many times a signal triggered in the last say 100 bars.

Lets take a simple example. If I want to count the number of green bars in the last 100 bars? Or number of OB bars in the last 100 bars? Number of inside bars in the last 100 bars.

is it possible to write a pCF to do this counting?

Thank you for  your help.

bcochrane
Posted : Friday, April 17, 2015 6:37:14 PM
Registered User
Joined: 9/17/2010
Posts: 484

I'm not the expert but you may find some help over the week end in this post.

Is it possible to write a pcf that will output bars up?

 

StockGuy
Posted : Sunday, April 19, 2015 10:57:13 AM

Administration

Joined: 9/30/2004
Posts: 9,187

You can plot a Custom PCF % True that will plot the percentage of bars that a formula is True over the previous x bars.  So if you have a formula for "green bars" and "OB bars", you can pop that into a Custom PCF %True indicator.

Since your lookback is 100 bars, the % value will match the count.  41% means it passed 41 of the last 100 bars.

busterram
Posted : Monday, April 20, 2015 12:44:33 PM
Registered User
Joined: 10/9/2011
Posts: 485

Thank  you for the response. Appreciate it. 

Would you be able to provide an example of how to set this up. Say my formula is 

h > h1 and l < l1

I want to find out how many such conditions were present in the last X bars. If 100 is the max tc2000 allows, then lets say last 100 bars.

How would I set that up? Is there a CountIf function? Many platforms have something like

CountIf(Condition, Numberofbars) where it tells me how many times a condition occurred in the bars specified. Would like to replicat ethe same in tc2000.

Thank you for your help.

Bruce_L
Posted : Monday, April 20, 2015 1:24:38 PM


Worden Trainer

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

Add a Custom PCF Indicator to the chart.

Edit the Custom PCF Indicator to set the Period to the number of bars of interest and the Average Type to Simple.

If the Period is 100 and the Condition Formula of interest is H > H1 AND L < L1 then you would use the following Indicator Formula.

100 * ABS(H > H1 AND L < L1)

So you would be putting the Condition Formula of interest inside an ABS() function and multiplying it by the Period.

The above method would give you a count for any Period. So you could set the Period to 50 and use 50 * ABS(H > H1 AND L < L1) to display the count using the Custom PCF Indicator.

StockGuy was mentioning the special case where the period is 100. In this case, you can use a Cusotm PCF % True Indicator instead of using a Custom PCF Indicator. You would set the Period to 100 and the Average Type to Simple as before, but you can just use the formula of instead instead of putting it inside an ABS() function and multiplying it by the Period. So the Boolean Formula would just be the following.

H > H1 AND L < L1

Note that the Custom PCF % True Indicator only gives you a count when the Period is 100. This is because the count and the percentage of the time something is true is the same in such instances. In other cases it ould still return the percentage of the time something is true, it just wouldn't be the count of how many times it was true.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
busterram
Posted : Wednesday, April 22, 2015 11:55:43 AM
Registered User
Joined: 10/9/2011
Posts: 485

Beautiful. I tried this out. Worked out well. Thank  you Bruce for your detailed response appreciate it.

Can the same method be used to get the avg bar size? Say I do 100 * (h-l) and set the avg to 100 as well. The value I get is the total of h-l in the last 100 bars and I divide that by 100 to get the avg h-l in the last 100 bars. is that a good way to do this?

 

Thank you again bruce,

Have a good day

 

Bruce_L
Posted : Wednesday, April 22, 2015 12:29:17 PM


Worden Trainer

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

That should work just fine.



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