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 |

Error in MIN and/or MAX function Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
gordonerlebach
Posted : Saturday, August 23, 2014 11:34:28 AM
Gold Customer Gold Customer

Joined: 9/7/2012
Posts: 34

Hi 

I am using version 12.4 of TC2000. 
Try the formula: 
 
(c > MAX(o1,c1)) and (o < MIN(o1,c1)) 
 
The MAX and MIN function return the same results (just use the testing facility on a few stocks). I view this as important given that you make decisions based on your own formulas. 
 
This is incredible, unless there is something basic I do not understand. 
 
    Thanks,
 
     Gordon
gordonerlebach
Posted : Saturday, August 23, 2014 11:43:16 AM
Gold Customer Gold Customer

Joined: 9/7/2012
Posts: 34

[QUOTE=gordon.erlebach]

Hi 

I am using version 12.4 of TC2000. 
Try the formula: 
 
(c > MAX(o1,c1)) and (o < MIN(o1,c1)) 
 
Try the following as well: 
 
MAX(o1,c1) and MAX(c1,o1)  
 
and test the formulas. The results of the two are different!  How can this possibly be? 
 
The MAX and MIN function return the same results (just use the testing facility on a few stocks). I view this as important given that you make decisions based on your own formulas. 
 
This is incredible, unless there is something basic I do not understand. 
 
    Thanks,
 
     Gordon

 

diceman
Posted : Sunday, August 24, 2014 10:12:42 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

Your PCFs are not using proper syntax.

 

 

Thanks

 

Quiktdr
Posted : Monday, August 25, 2014 9:56:58 AM
Registered User
Joined: 10/7/2004
Posts: 794

Bruce,    I found two formulas in my files and I am wonering what they are stating in English. Also can these formulas be used in Vs 7 and 12?   XAVGC5 - C1  <= 0 && C - XAVGC5 >= .02  && (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) < 0       and      XAVGC5 - C1  >= 0 && C - XAVGC5 <= .02  && (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) > 0    TY

Bruce_L
Posted : Monday, August 25, 2014 12:20:00 PM


Worden Trainer

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

gordon.erlebach,
The MAX() and MIN() functions do not do what you seem to be assuming.

The MAX() function checks for the maximum value of an indicator over time. It does not check for higher of two values.

The MIN() function checks for the minimum vaule of an indicator over time. It does not check for the lower of two values.

PCF Formula Descriptions

If you want to check for the higher of O1 and C1, you could use:

ABS(O1 >= C1) * O1 + ABS(O1 < C1) * C1

Or possibly:

(O1 + C1 + ABS(O1 - C1)) / 2

If you want to check for the lower of O1 and C1, you could use:

ABS(O1 <= C1) * O1 + ABS(O1 > C1) * C1

(O1 + C1 - ABS(O1 - C1)) / 2

Min Max PCFs



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Bruce_L
Posted : Monday, August 25, 2014 12:31:38 PM


Worden Trainer

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

Quiktdr,
The Personal Criteria Formula does not recognize && syntax and it should not be used.

XAVGC5 - C1 <= 0 AND C - XAVGC5 >= .02 AND (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) < 0

Would check for the current 5-period exponential moving average to be less than or equal to the previous close, the current price to be at least .02 above the current 5-period exponential moving average and the current MS to be less than 5 bars ago. The formula could be shortened significantly.

XAVGC5 <= C1 AND C >= XAVGC5 + .02 AND MS < MS1.5

While:

XAVGC5 - C1 >= 0 AND C - XAVGC5 <= .02 AND (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) > 0

Would check for the current 5-period exponential moving average to be greater than or equal to the previous close, the current price to be at least .02 below the current 5-period exponential moving average and the current MS to be greater than 5 bars ago. The formula could be shortened significantly.

XAVGC5 >= C1 AND C <= XAVGC5 + .02 AND MS > MS1.5

The formulas without the &&s in them can be used in both TC2000 version 7 and TC2000 version 12.4.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Quiktdr
Posted : Monday, August 25, 2014 1:00:35 PM
Registered User
Joined: 10/7/2004
Posts: 794

I appreciate your answrer but your shortened version does not seem to be the same as their are some differences in revised version.                                                                                                              XAVGC5 - C1 <= 0 AND C - XAVGC5 >= .02 AND (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) < 0    and        XAVGC5 - C1 >= 0 AND C - XAVGC5 <= .02 AND (100* (MS - MS1.5) / ( max(ms1,99) - min(ms1,99) )) > 0    mimic the original formula by  replacing the and instead of  &&.

Bruce_L
Posted : Monday, August 25, 2014 1:30:23 PM


Worden Trainer

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

The long and short versions of the formulas without the &&s in them definitely return exactly the same results on my system.

Neither revised version of the formulas match the results of the versions with &&s in them because the && syntax is not valid.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Quiktdr
Posted : Monday, August 25, 2014 2:02:03 PM
Registered User
Joined: 10/7/2004
Posts: 794

You are correct!     Thank you

Quiktdr
Posted : Monday, August 25, 2014 2:05:30 PM
Registered User
Joined: 10/7/2004
Posts: 794

you are correct on the daily but it is different on the 15'     Thank you

Bruce_L
Posted : Monday, August 25, 2014 2:36:42 PM


Worden Trainer

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

I get identical results when the long and short versions of each formula are set to 15 minutes as well as when they are set to daily. They just have to be set to the same time frame.

I do not know why you would be getting different results. The formulas are mathematically equivalent to each other.



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