Gold Customer
Joined: 7/31/2006 Posts: 2

Could you please provide the formulas for each of the Functions, Math Operations, etc. for the listings on the right side of the "Editing formula for Net change" menu. For example: C is Closing price, XAVGV is ???.
Also, is there a more detail description of how to write a PCF other than in the Telechart User Guide, 02/03 Revision? If so, how do I obtain one?
Thanks for your help.
Bill Ellis


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

There is significantly improved syntax available in TC2000 v17.
Version 17 PCF Capabilities
Personal Criteria Formula Syntax
Indicators:
AVGCx.z > Simple Moving Average of Close/Last Price
AVGHx.z > Simple Moving Average of High Price
AVGLx.z > Simple Moving Average of Low Price
AVGOx.z > Simple Moving Average of Open Price
AVGVx.z > Simple Moving Average of Volume
BOPy.z > Balance of Power (Green>30,Red<30,Yellow30to–30)
Cz > Close/Last Price
Hz > High Price
Lz > Low Price
MAXCx.z > Maximum of Close/Last Price
MAXHx.z > Maximum of High Price
MAXLx.z > Maximum of Low Price
MAXOx.z > Maximum of Open Price
MAXVx.z > Maximum of Volume
MINCx.z > Minimum of Close/Last Price
MINHx.z > Minimum of High Price
MINLx.z > Minimum of Low Price
MINOx.z > Minimum of Open Price
MINVx.z > Minimum of Volume
MSy.z > Cumulative MoneyStream
Oz > Open Price
OBVy.z > On Balance Volume
RSIx.y.z > RSI (not Wilder's Smoothed)
STOCx.y.z > Simple Stochastic
TSVy.z > Time Segmented Volume
Vz > Volume
XAVGCx.z > Exponential Moving Average of Close/Last Price
XAVGHx.z > Exponential Moving Average of High Price
XAVGLx.z > Exponential Moving Average of Low Price
XAVGOx.z > Exponential Moving Average of Open Price
XAVGVx.z > Exponential Moving Average of Volume
Functions:
ABS(w ) > Absolute Value
AVG(w,x) > Simple Moving Average
EXP(w ) > Natural Exponent
LOG(w ) > Natural Log
MAX(w,x) > Maximum
MIN(w,x) > Minimum
SGN(w ) > Sign (1, 0 or 1)
SQR(w ) > Square Root
XAVG(w,x) > Exponential moving Average
Functions (unsupported):
ATN(w ) > Arctangent
COS(w ) > Cosine
COT(w ) > Cotangent
CSC(w ) > Cosecant
NOT(w ) > Not (Boolean)
SEC(w ) > Secant
SIN(w ) > Sine
SINH(w ) > Hyperbolic Sine
TAN(w ) > Tangent
TANH(w ) > Hyperbolic Tangent
Where w is the Number or Indicator to which a Function is applied.
 w cannot be a formula or function for AVG(), MAX(), MIN(), XAVG()
Where x is the Period of the Indicator or Function.
Where y is a the Period of an additional Simple Moving Average.
Where z is the number of Periods Ago.
 z can also be a date. May 3, 2007 would be (single quotes required): '05/03/07'
The arguments in indicators are separated by periods while the arguments in functions are separated by commas.
Operators:
* > Multiply
/ > Divide or Ratio
+ > Add
 > Subtract or Difference
> > Greater Than (Boolean)
>= > Greater Than or Equal To (Boolean)
< > Less Than (Boolean)
<= > Less Than or Equal To (Boolean)
= > Equal To (Boolean)
<> > Not Equal To (Boolean)
OR > Or (Boolean)
AND > And (Boolean)
Operators (unsupported):
\ > Integer Divide
^ > Power
MOD > Modulo
Order of operations:
*,/
+,
>,>=,<,<=,=,<>
OR
AND
() > Parentheses will force an operation to perform earlier in the order.
Booleans in Value based Formulas (unsupported):
Placing a Boolean expression inside parentheses will return 1 for True or 0 for False when it is part of a larger value based formula.
Placing a Boolean expression inside an ABS() function will return 1 for True or 0 for False when it is part of a larger value based formula.
You may wish to review the following:
How to create a Personal Criteria Forumula (PCF)
Handy PCF example formulas to help you learn the syntax of PCFs!
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/17/2004 Posts: 143

Bruce,
You wrote above how to calculate a Simple Moving Average of a function, and seemed to infer any function would work, as long as it wasn't a max,min,avg, or xavg.
But, when I tried to put the following function in, I got an error. Would you help?
Here it is, standalone (no error):
EXP((4.5 * LOG(C ) + 3.5 * LOG(C1) + 2.5 * LOG(C2) + 1.5 * LOG(C3) + .5 * LOG(C4) .5 * LOG(C5) 1.5 * LOG(C6) 2.5 * LOG(C7) 3.5 * LOG(C8) 4.5 * LOG(C9)) / (4.5^2+3.5^2+2.5^2+1.5^2+.5^2)*2)  1
Here it is in your SMA calculator (it generates an error):
avg(EXP((4.5 * LOG(C ) + 3.5 * LOG(C1) + 2.5 * LOG(C2) + 1.5 * LOG(C3) + .5 * LOG(C4) .5 * LOG(C5) 1.5 * LOG(C6) 2.5 * LOG(C7) 3.5 * LOG(C8) 4.5 * LOG(C9)) / (4.5^2+3.5^2+2.5^2+1.5^2+.5^2)*2)  1,100)
Thanks!


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

jfh132,
AVG() is one of the four functions listed as not being able to take a formula or function as an argument. Placing the first formula within the AVG() function is the type of thing I was attempting (apparently unsuccessfully) to specifically point out would not work.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/17/2004 Posts: 143

Oh, well. Thanks anyway.


Registered User Joined: 1/28/2008 Posts: 19

thanks Bruce for the help


Registered User Joined: 12/5/2007 Posts: 29

Dear Trainer
First, thank you for the list of indicators.
I see that in the descriptions, the power operator is not supported. I'm not a math guy, so be gentle!!
Operators (unsupported):
\ > Integer Divide
^ > Power
MOD > Modulo
I have been using this PCF in an CCI
10 day std dev SQR(ABS(C^2 + C1^2 + C2^2 + C3^2 + C4^2 + C5^2 + C6^2 + C7^2 + C8^2 + C9^2  10 * AVGC10^2) / 10)
When I place it in a PCF and test it, it does not generate a syntax error, am I getting the correct answer?
Thank you, at your convience.
Sloop22


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

sloop22,
The unsupported Functions, Operators and Boolean tests work.
They are not included in TeleChart's documentation however and they may not function the same way in future versions of TeleChart.
The way Boolean tests work has changed at least once in the past of which I am aware for example.
That said, I suspect most of these unsupported aspects of the TeleChart Personal Criteria Formula Language will, for the most part, continue to operate in the future as they do now.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 9/16/2008 Posts: 9

Hello,
I dont really understand what does e.g. MINL15.7 mean?.(from the formula in the Worden report on Jan 4th 2008)
Can you help me with that? And what would be the formula if I want to import this condition to Blocks Real Code ?
Thanks for the help
pvputtkamer


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

pvputtkamer,
MINL15.7 is the lowest low of the 15Bar period ending 7Bars Ago. In RealCode it would be Price.MinLow(15,7).
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/17/2004 Posts: 143

How do I undo "watch this topic", if I no longer want to see new postings in a particular thread?


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

jfh123,
 Select My Profile (it's near the upper righthand corner of the forums)  Subscriptions.
 Go down to the Topics sections and check the Topic.
 Select Unsubscribe in the Topics sections (not in the Forums section).
You may wish to review the following:
Learn how to use the forums: post a new topic, reply, Search existing topics
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 9/16/2008 Posts: 9

QUOTE (Bruce_L) pvputtkamer,
MINL15.7 is the lowest low of the 15Bar period ending 7Bars Ago. In RealCode it would be Price.MinLow(15,7).
So its the minimum low from the time 22 (15+7) bar ago to the time 7 bars ago?


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

pvputtkamer,
No, the Bar of 7Bars Ago is part of those 22Bars, so it would be the Minimum Low from 21Bars Ago inclusive to 7Bars Ago inclusive.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 6/4/2007 Posts: 3

Hi, i'm still quite new to PCF's, i've watched all the videos. i have written a PCF for price closing below the 50 sma and above the 200sma. i also want the scan to indicate a stochastic of 3,2,3 crossing down through 20
so far i have C < AVGC50 AND C1 > AVGC50.1 AND C > AVGC200 AND STOC3.2.1 > 20 AND STOC3.2 <=20
not sure if i'm stringing it all together.
i would also like to be able to produce a formula for the day's low crossing below the 50sma and closing above (effectively a hammer)
any pointers?? kind regards. James


Registered User Joined: 1/28/2005 Posts: 6,049

"i would also like to be able to produce a formula for the day's low crossing below the 50sma and closing above"
Try:
L<XAVGC50ANDC>XAVGC50
(this is the low was below the 50 but the close was above)
You may be interested in this:

You may be interested in this from an old post of mine
about stochastics:
Value A:
STOC20.1
This is the "raw" stochastic value over 20 periods.
Also called %K

Value B:
STOC20.3
This is value A smoothed by a 3 period simple moving
average.
Also called "slow" stochastic.

Value C:
AVG(STOC20.3,3)
This is a 3 period simple smoothing applied to value B.
Also know as %D

Value D:
XAVG(STOC20.3,3)
This is a 3 period exponential smoothing applied to value B.
Also know as %D

Value E:
XAVG(STOC20.1,3)
This is value A "raw" stochastic with 3 period exponential smoothing.

Value D alternate:
.500488758553275 * (XAVG(STOC20,3) + .5 * (XAVG(STOC20.1.1,3) + .5 * (XAVG(STOC20.1.2,3) + .5 * (XAVG(STOC20.1.3,3) + .5 * (XAVG(STOC20.1.4,3) + .5 * (XAVG(STOC20.1.5,3) + .5 * (XAVG(STOC20.1.6,3) + .5 * (XAVG(STOC20.1.7,3) + .5 * (XAVG(STOC20.1.8,3) + .5 * (XAVG(STOC20.1.9,3)))))))))))
QUOTE (diceman)
How would historical values be written? All these values 7 bars ago?
Value A: STOC20.1.7
Value B: STOC20.3.7
Value C: AVG(STOC20.3.7,3)
Value D: XAVG(STOC20.3.7,3)
Value D Alternate: .500488758553275 * (XAVG(STOC20.1.7,3) + .5 * (XAVG(STOC20.1.8,3) + .5 * (XAVG(STOC20.1.9,3) + .5 * (XAVG(STOC20.1.10,3) + .5 * (XAVG(STOC20.1.11,3) + .5 * (XAVG(STOC20.1.12,3) + .5 * (XAVG(STOC20.1.13,3) + .5 * (XAVG(STOC20.1.14,3) + .5 * (XAVG(STOC20.1.15,3) + .5 * (XAVG(STOC20.1.16,3)))))))))))
Value E: XAVG(STOC20.1.7,3)
Thanks
diceman


Registered User Joined: 6/4/2007 Posts: 3

thanks Diceman, i'll be sure to check those out.
just found out that the formula does work, i had just forgotten to update the criteria for all the items. doh.
seems like it works very nicely for identifying pullbacks in trending stocks.


Registered User Joined: 10/7/2004 Posts: 1

I do not see ATR, average true range. Is there another name for this? I'm wanting a formula for
ATR30 >= 3.


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

ellis,
Welcome to the forums. A very good foundation for learning how to use TeleChart can be gained by reviewing the following:
If you are new to TeleChart READ THIS FIRST!
Average True Range (ATR) is not one of TeleChart's built in Indicators. The ATR for PCF topic has formulas for a 30Period Average True Range (the formula depends on the type of Moving Average). Whichever you choose, you can just add the >= 3 onto the end.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 8/6/2013 Posts: 1

hi i am hassan and i am writting an expert.
please help me.
i wrote function to find candle stick patterns and return those code to program.
my problem is:
//}}}}} Test for Bullish RISING THREE METHODS pattern.
double AVGH21_4=iMA(Active_Symbol,0,21,0,MODE_SMA,PRICE_HIGH,4);
double AVGL21_4=iMA(Active_Symbol,0,21,0,MODE_SMA,PRICE_LOW,4);
double AVGH21_0=iMA(Active_Symbol,0,21,0,MODE_SMA,PRICE_HIGH,0);
double AVGL21_0=iMA(Active_Symbol,0,21,0,MODE_SMA,PRICE_LOW,0);
if ((C4>O4) && (H4_L4)>(AVGH21_4AVGL21_4) && C2<C3 && C1<C2 && C3<H4_
&& C3>L4 && C2<H4_ && C2>L4 && C1<H4_ && C1>L4 && MathAbs(C3O3)<=MathAbs(C4O4)*0.75
&& MathAbs(C2O2)<= MathAbs(C4O4)*0.75 && MathAbs(C2O2)<= MathAbs(C4O4)*0.75 && C>O &&
(H_L)>(AVGH21_0AVGL21_0) && C>C4)
{
code=853;
}
is my code correct ?
i use ima to calculate AVGx pcs in mq4 , is this correct?
please help me.
tnx yo a lot.
hassan


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

I am not familiar with the language used in mq4 and can only guess at the intent of of the supplied code. My best guess at a Condition Formula in TC2000 would be:
L4 < C1 AND C1 < C2 AND C2 < C3 AND C3 < H4 AND O4 < C4 AND C4 < C AND O < C AND ABS(C3  O3) <= (C4  O4) * .75 AND ABS(C2  O2) <= C4  O4 * .75 AND H  L > AVGH21  AVGL21 AND H4  L4 > AVGH21.4  AVGL21.4
Boolean PCFs for Candlestick Patterns
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/2/2010 Posts: 9

AVGCx.z > Simple Moving Average of Close/Last Price
does the dot(AVGCx.z) extend periods like such c1.c59 would indicate close/last of yesterday to 60 days ago?


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

c1.c59 doesn't mean anything.
C1 would be the close of 1bars ago.
C59 would be the close of 59bars ago.
C60 would be the close of 60bars ago.
AVGC1.59 would be the 1period simple moving average of 59bars ago (the same as C59).
AVGC10.60 would be the 10period simple moving average of 60bars ago.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/11/2013 Posts: 1

Bruce,
How do I generate ' the Minimum of the average of a parameter' or ' the Maximum of the average of a parameter'?
Thanks


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

There is no built in way of doing so unless the moving average is built into whatever is being averaged. This is because the MIN() and MAX() functions cannot accept compound formulas as arguments.
So you can calculate the 4period minimum of the 3period simple moving average of TSV for example:
MIN(TSV3,4)
But there is no built in way to do the same for a 3period exponential moving average because the following syntax is not valid:
MIN(XAVG(TSV,3),4)
If the period is 32 or less, you can use the techniques in the Min Max PCFs topic for this however.
(XAVG(TSV,3) + XAVG(TSV1.1,3)  ABS(XAVG(TSV,3)  (XAVG(TSV1.1,3))) + XAVG(TSV1.2,3) + XAVG(TSV1.3,3)  ABS(XAVG(TSV1.2,3)  (XAVG(TSV1.3,3)))  ABS(XAVG(TSV,3) + XAVG(TSV1.1,3)  ABS(XAVG(TSV,3)  (XAVG(TSV1.1,3)))  (XAVG(TSV1.2,3))  (XAVG(TSV1.3,3)) + ABS(XAVG(TSV1.2,3)  (XAVG(TSV1.3,3))))) / 4
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/7/2004 Posts: 35

Hi Bruce,
Is there any sequencing as to look for things involving DATES ie specific days of the year.?
thanx


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

The date replaces the bars ago parameter (z in the list of syntax in the first post). If there is a . in the syntax, it is required, but you shouldn't put a . in if it isn't part of the syntax. For example:
C'12/09/2013'
Would access the closing price on December 9, 2013 and doesn't have a . in it, but:
MAXH7.'12/09/2013'
Does have a period in it because there is normally a . in between the period of the maximum high and its bars ago parameter.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 12/31/2004 Posts: 2

Bruce,
How can I create a PCF of the Average Trading Range over 14 days?
Thanks,
Brian


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

If you just want the average range of each trading day.
AVGH14  AVGL14
But if you want Average True Range (which includes the close of the previous bar in the range to account for gaps), you would want to use the 14Period Simple Moving Average of True Range from the following topic.
Please provide a description and PCF for calculating an ATR value to be used as a stop loss value
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/13/2014 Posts: 8

How to write a PCF that will draw a line 6% below the closing price?


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

Add a Custom PCF Indicator to the chart with the following settings:
 Period: 1
 Average Type: Simple
 Formula: 0.94 * C
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 3/13/2014 Posts: 8

How do I add the custom PCF to the top price window, so that I see the equation line, the 94% line, with the price chart?


Registered User Joined: 3/13/2014 Posts: 8

I'm actually in vs. 12.4


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

You can click on Price History (the symbol and company name at the top of the pane where price is plotted) and select Add Plot Here... to add a plot to price pane directly.
You could also just select Add Plot to Chart (the green + in the upper left of the chart) and select Custom PCF Indicator to add it in its own pane. Then click on the move icon (an arrow pointing both up and down) to the left of the indicator and select Overlay & Scale With in the price pane.
Indicator Scaling (2:38)
Price Scaling (5:46)
Adding and Moving Indicators (7:19)
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 10/31/2015 Posts: 2

Hi,
Is it possible to get the number of candles since the open of the day (in any timeframe)
or to get the duration since the open, or simply the actualy time ?
Thanks for advance.


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

No, there is no way to determine either thing in a PCF currently.
Bruce Personal Criteria Formulas TC2000 Support Articles


Registered User Joined: 1/9/2017 Posts: 13

Hey folks
is that the right PCF for 36MACD<36MACD 1 bar ago ?
XAVGC3XAVGC6<XAVGC3.1XAVGC6.1
Thanks,
Boyko


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

Yes, it is the correct formula. There is a slightly shorter way to write this in the TC2000 v17 beta.
MACD3.6 < MACD3.6.1
Bruce Personal Criteria Formulas TC2000 Support Articles


Guest1 