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

PCF Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
lc29470
Posted : Thursday, February 23, 2017 6:27:48 PM
Registered User
Joined: 12/29/2013
Posts: 71

Hi Bruce, I have pcf for a Bullish  Macd cross,

XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) > 0 AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) +XAVG(XAVGC26.1,9) <= 0

I wold like to add a Dot above the  candle when condition is true.

Can you help?

Thanks L.C.

markhike
Posted : Thursday, February 23, 2017 10:26:49 PM
Registered User
Joined: 5/23/2006
Posts: 75

QUOTE (lc29470)

Hi Bruce, I have pcf for a Bullish  Macd cross,

XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) > 0 AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) +XAVG(XAVGC26.1,9) <= 0

I wold like to add a Dot above the  candle when condition is true.

Can you help?

Thanks L.C.

 

abs(XAVGC12 - XAVGC26 - XAVG(XAVGC12,9) + XAVG(XAVGC26,9) > 0 AND XAVGC12.1 - XAVGC26.1 - XAVG(XAVGC12.1,9) +XAVG(XAVGC26.1,9) <= 0) * H * 1.005
 
 
 
Bruce_L
Posted : Friday, February 24, 2017 8:45:45 AM


Worden Trainer

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

If you have TC2000 v17, I would use the following Formula in a Custom PCF Indicator plotted in the same pane and scale as price.

1.005 * H / ABS(XUP(MACD12.26, XAVG(MACD12.26, 9)))

I would use the following Formula instead in earlier versions of TC2000.

1.005 * H / ABS(XAVGC12 - XAVGC26 > XAVG(XAVGC12,9) - XAVG(XAVGC26,9) AND XAVGC12.1 - XAVGC26.1 <= XAVG(XAVGC12.1,9) - XAVG(XAVGC26.1,9))

For the most part this will work the same as the formula provided by mdhuang. The difference is that using division in the order given will produce an division by zero error when false while using multiplication will produce 0 when false.

The advantage to producing the division by zero error is that no dot plots at all. If you use multiplication there will be a line of dots at zero where false instead.

How to Overlay an Indicator



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
lc29470
Posted : Friday, February 24, 2017 9:50:56 AM
Registered User
Joined: 12/29/2013
Posts: 71

Thank you Bruce, and mdhuang.

Bruces 1st PCF worked fine.

donv98
Posted : Friday, March 10, 2017 11:35:36 AM
Registered User
Joined: 7/29/2010
Posts: 417

QUOTE (Bruce_L)

If you have TC2000 v17, I would use the following Formula in a Custom PCF Indicator plotted in the same pane and scale as price.

1.005 * H / ABS(XUP(MACD12.26, XAVG(MACD12.26, 9)))

I would use the following Formula instead in earlier versions of TC2000.

1.005 * H / ABS(XAVGC12 - XAVGC26 > XAVG(XAVGC12,9) - XAVG(XAVGC26,9) AND XAVGC12.1 - XAVGC26.1 <= XAVG(XAVGC12.1,9) - XAVG(XAVGC26.1,9))

For the most part this will work the same as the formula provided by mdhuang. The difference is that using division in the order given will produce an division by zero error when false while using multiplication will produce 0 when false.

The advantage to producing the division by zero error is that no dot plots at all. If you use multiplication there will be a line of dots at zero where false instead.

How to Overlay an Indicator

Bruce,

  I am not able to get this pcf from above to work

1.005 * H / ABS(XAVGC12 - XAVGC26 > XAVG(XAVGC12,9) - XAVG(XAVGC26,9) AND XAVGC12.1 - XAVGC26.1 <= XAVG(XAVGC12.1,9) - XAVG(XAVGC26.1,9))

It plots a value.

Thank you for any help.

Don

Bruce_L
Posted : Friday, March 10, 2017 11:43:29 AM


Worden Trainer

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

Yes, it plots a value because it is an Indicator Formula and that is what it is designed to do. It plots dots on the chart when used as a Custom PCF Indicator with the Plot Style set to Dots. It plots dots at 1.005 times the high when tthe condition portion of the formula is true and nothing when the condition portion of the formula is false (because it produces a diviion by zero error in such cases).

If you only want the Condition Formula portion of the Indicator Formula, it would be the following.

XAVGC12 - XAVGC26 > XAVG(XAVGC12,9) - XAVG(XAVGC26,9) AND XAVGC12.1 - XAVGC26.1 <= XAVG(XAVGC12.1,9) - XAVG(XAVGC26.1,9)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Friday, March 10, 2017 12:05:31 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

   Thank you for helping me understand.

I really like the trick of plotting a dot 1.005 times the high.

Very useful.

Don

 

donv98
Posted : Friday, March 10, 2017 12:27:12 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

   I am wondering how universally the trick above can be applied.'

Can this trick be used to convert any Boolean into  a dot plotted on the chart?

Bruce_L
Posted : Friday, March 10, 2017 12:44:35 PM


Worden Trainer

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

I believe it is a universal solution. I can't think of any Booleans for which it wouldn't work, but could be missing something.

(value at which to plot the dot) / ABS(boolean)

It would probably be considerd preferable to use the following format in TC2000 v17, but it is actually a bit longer and doesn't work in earlier versions of TC2000.

(value at which to plot the dot) / IIF(boolean, 1, 0)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
donv98
Posted : Friday, March 10, 2017 1:11:08 PM
Registered User
Joined: 7/29/2010
Posts: 417

Bruce,

    Many thanks for  helping me understand  this valuable trick.

Don

Surveyor
Posted : Saturday, March 11, 2017 11:18:09 PM
Registered User
Joined: 10/7/2004
Posts: 2

Bruce

 

If I write a formula using new functions in 17, will that cause problems if I open 12?

 

Thanks DT

Surveyor
Posted : Saturday, March 11, 2017 11:20:10 PM
Registered User
Joined: 10/7/2004
Posts: 2

Bruce

Just noticed that your date is my date.  ??

DT

 

Bruce_L
Posted : Monday, March 13, 2017 9:56:52 AM


Worden Trainer

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

Not sure what the "your date is my date" remark means.

It kind of depends what you mean by problems. If the formula has syntax which won't work in TC2000 v12, than the item using that formula isn't going to work in v12 (so a Custom PCF Indicator won't plot for example).

But even though things might not be backwards compatible, it shouldn't mess up TC2000 v12 to open something containing v17 specific features. Those features just shouldn't function.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ogsol
Posted : Monday, March 13, 2017 8:01:56 PM
Registered User
Joined: 11/5/2013
Posts: 9

hi bruce

need help with a pcf

price opening at or very near ema.The closer the better

Bruce_L
Posted : Tuesday, March 14, 2017 9:25:14 AM


Worden Trainer

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

The percentage that the open is away from the current EMA20 can be written as follows.

100 * (O / XAVGC20 - 1)

So checking for this being 0.1% or less could be written as follows.

100 * (O / XAVGC20 - 1) <= .1

The percentage that the open is away from the EMA20 at the time of the open can be written as follows.

100 * (O / ((2 * O + 19 * XAVGC20.1) / 21) - 1)

And checking for this being less than say 0.2% could be written as follows.

100 * (O / ((2 * O + 19 * XAVGC20.1) / 21) - 1) < .2



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
diceman
Posted : Tuesday, March 14, 2017 12:58:47 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

QUOTE (Bruce_L)

Not sure what the "your date is my date" remark means.

 

Your Joined date is the same.

 

 

Bruce_L
Posted : Tuesday, March 14, 2017 1:17:08 PM


Worden Trainer

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

Thanks for pointing it out (not sure why I didn't see it myself). I woould say that is quite a coincidence, but it is probably the most common joined date in the forums. It is the date the forums were first populated using all of the customers at the time. It just used the date of the import instead of checking to see when a user had actually become a customer, so anybody around that date or earlier has that date as a joined date.

There are a few earlier joined dates, but these are all for people involved in setting up and testing the forum before it went live.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ogsol
Posted : Tuesday, March 14, 2017 3:31:31 PM
Registered User
Joined: 11/5/2013
Posts: 9

The percentage that the open is away from the EMA20 at the time of the open can be written as follows.

100 * (O / ((2 * O + 19 * XAVGC20.1) / 21) - 1)

And checking for this being less than say 0.2% could be written as follows.

100 * (O / ((2 * O + 19 * XAVGC20.1) / 21) - 1) < .2

 

hi bruce keep getting error message with formula on line 4 .couild you check this again for me

Bruce_L
Posted : Tuesday, March 14, 2017 3:48:13 PM


Worden Trainer

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

The error was caused by a problem with the parentheses which should be fixed above.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
ogsol
Posted : Tuesday, March 14, 2017 9:47:43 PM
Registered User
Joined: 11/5/2013
Posts: 9

sorry for been a pain bruce but results not quite what i am looking for

I need price on daily charts to open almost sitting on 20ema.

in most of the results price is quite far away frim ema 20

 

Bruce_L
Posted : Wednesday, March 15, 2017 9:32:16 AM


Worden Trainer

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

You can adjust the .2% at the end of the formula to something smaller. The following would check for 0.05% instead of 0.2%

100 * (O / ((2 * O + 19 * XAVGC20.1) / 21) - 1) < .05

That said, how are you determining if the symbol opened near the moving average?

Keep in mind the value of the moving average can change significantly throughout the trading day. If you are comparing the open to the current value of the moving average, you would use something like the following (for 0.05%).

100 * (O / XAVGC20 - 1) <= .05

This won't tell you if it actually opened near the moving average (because the moving average has changed), but it will tell you if it is near the moving average now (which is all you can actually check visually now).



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