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

Hi,
Can you write a PCF for Telechart that colors an area of the chart green or red based on the rate of change/momentum of the MACD? I would like to know when the signal line has stopped moving in a trending fashion and is now flattening or losing steam. Also, is it possible to have multiple time frames, i.e. daily, hourly, 10 minute, etc. displaying on one chart simultaneously?
Perhaps this is a crazy question....just want to put it out there. Thanks in advance.

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

You can have multiple charts with different time frames in the same layout, but you cannot have multiple time frames in the same chart simultaneously.
We can plot dots on the chart based on if the MACD Histogram is going up or down. We can color the MACD Histogram based on if it is going up or down. Both of these techniques would use Custom PCF Indicators.
What would be the settings of the MACD Histogram?
More importantly, how do you want to distinguish the "flattening or losing steam" part? Percent changes in the MACD Histogram don't make much sense (since it crosses through zero). The net changes in MACD are going to depend as much or more on the actual price of stock as on if the MACD Histogram is flattening or not.
Bruce Personal Criteria Formulas TC2000 Support Articles

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

The only way I can think of is to calculate the slope of the last two data points. The closer the slope gets to 0 would represent flattening. Settings would be the standard 12, 36.

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

The slope of an exponential MACD 12, 26 from one bar to the next can be written as follows.
Understanding MACD
XAVGC12  XAVGC26  XAVGC12.1 + XAVGC26.1
We can do this with three terms instead of four, but the formula isn't really much shorter.
Cascades of Moving Averages
(28 * C  54 * XAVGC12.1 + 26 * XAVGC26.1) / 351
But it does make for a slightly shorter check for the MACD moving up.
14 * C + 13 * XAVGC26.1 > 27 * XAVGC12.1
And moving down.
14 * C + 13 * XAVGC26.1 < 27 * XAVGC12.1
So you could plot the following Custom PCF Indicator in the same pane and scale as the MACD in green to indicate when the MACD was going up. You will probably want to try using both the Dot and Histogram plot styles to see which you like better.
(XAVGC12  XAVGC26) / ABS(14 * C + 13 * XAVGC26.1 > 27 * XAVGC12.1)
And the following Custom PCF Indicator in the same pane and scale and the MACD in red to indicate when the MACD was going down.
(XAVGC12  XAVGC26) / ABS(14 * C + 13 * XAVGC26.1 < 27 * XAVGC12.1)
But I'm not sure how close to zero things would need to be to use a different color.
(XAVGC12  XAVGC26) / ABS(XAVGC12  XAVGC26  XAVGC12.1 + XAVGC26.1 < .01)
If we use .01 there is going to be an awful lot of yellow for some symbols and not much yellow at all for other symbols.
Bruce Personal Criteria Formulas TC2000 Support Articles

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

Thank you so much for your help. I appreciate the videos and effort you put into this. I will work with it and get back to you with feedback.

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

Hi Bruce,
When I input the following;(XAVGC12  XAVGC26) / ABS(14 * C + 13 * XAVGC26.1 > 27 * XAVGC12.I get a division by zero error.
The second equation plots as a line that waves up and down, so I'm not sure if the MACD is going up when the indicator is going up and vice versa.
My major problem is that I'm confused by the math logic here. . such as multiplying by 28, etc. and the order of operations. If you could add a little more explanation for the sorry state of my math skills(it's been a really long time since I had to use any math) or a link reference to an explanation would really help me.
Also, I can't get the PCF to plot in the exact pane as the MACE, it plots in its own separate one.
Any help would be most appreciated. Thank you Bruce for your patience.
sheana

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

It is supposed to create a division by zero error when the requirements are not met. That way it doesn't plot anything when the requirements are not met and only plots something on the chart when the requirements are true.
The idea is to plot the MACD. This is useful because this indicator plots values at all points.
Then plot the various Custom PCF Indicators in the same pane and scale as the MACD to give you colors based on if the various requirements are met or not.
You will want to use either a Histogram or a Dot Ploty Style for the Custom PCF Indicators.
Here is a quick video on indicator scaling which covers overlaying indicators into the same pane and scale.
Indicator Scaling (2:38)
The order of operations is as follows with the stuff at the top being done first.
Order of operations:
*,/
+,
>,>=,<,<=,=,<>
OR
AND
() > Parentheses will force an operation to perform earlier in the order.
The way the formulas work is that everythin inside parentheses returns 1 if true or 0 if false. By using an ABS() function instead of plain parentheses, we are forcing a 1 when true and 0 when false result instead.
So when we divide the MACD by 1, it plots a dot or histogram bar at the value of the MACD. When we divide the MACD by 0, it doesn't plot anything (because it generates a division by zero error).
Bruce Personal Criteria Formulas TC2000 Support Articles

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

Thanks again, this really helps!

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

You're welcome.
Bruce Personal Criteria Formulas TC2000 Support Articles
