## New version 18 available now

Subscription & data-feed pricing Class schedule

Margin rates Stock & option commissions

 Change color of Moving Ave based on direction Rate this Topic:
 Previous Topic · Next Topic Watch this topic · Print this topic ·
 Posted : Thursday, June 14, 2018 11:27:21 AM
Registered User
Joined: 1/24/2010
Posts: 3

I was looking to see if there is a way to change the color of a moving average depending on the direction. I examined the possibility that you could have two averages, on that would only print if the move is up and another if there is another down. However, my programming experience with TC2000 PCF's is still limited and I don't know if this functionality actually possible. If there is a way to do this then any help would be appreciated. Thanks !

Bruce_L
 Posted : Thursday, June 14, 2018 11:31:47 AM

Worden Trainer

Joined: 10/7/2004
Posts: 64,136

There is no way to actually change the color of the moving average.

You can however create two (or three if you want a color for not changing direction) Custom PCF Indicators using different colors and the Dots Plot Style and plot them in the same pane and scale as the moving average.

So for example, with a 10 period simple moving average, you could use the following Formula setting in the Custom PCF Indicator for the up dots.

`IIF(AVGC10 > AVGC10.1, AVGC10, 1 / 0)`

And the following Formula setting for the Custom PCF Indicator plotting the down dots.

`IIF(AVGC10 < AVGC10.1, AVGC10, 1 / 0)`

Note that the 1 / 0 creating division by zero error on purpose in order to make it so the formula doesn't plot a dot when false.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Al_Gorithm
 Posted : Thursday, June 14, 2018 2:57:29 PM

Gold Customer

Joined: 6/30/2017
Posts: 1,156

I swear I saw someone using TC2000 in some online event with either a moving average or some other oscillating plot that alternated colors based on direction, without using dots, ... but it could just be the summer heat.

Bruce_L
 Posted : Thursday, June 14, 2018 3:10:41 PM

Worden Trainer

Joined: 10/7/2004
Posts: 64,136

I can't think of a way to do so (which doesn't mean it isn't possible).

You can't use the 1 / 0 trick to force a division by zero error in a line chart like you can with the Dots and Histogram Plot Styles. Well you can, but it will still connect the the value which do plot with lines.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Al_Gorithm
 Posted : Thursday, June 14, 2018 6:34:30 PM

Gold Customer

Joined: 6/30/2017
Posts: 1,156

No worries, it's just eye candy, IMO. The smarter I get, the simpler my charts get.

 Posted : Thursday, June 14, 2018 8:20:42 PM
Registered User
Joined: 1/24/2010
Posts: 3

I thought that I had seen this as well but couldn't think how they had done it. Anyhow this will work fine and if I find another way then I'll update this thread.

Thanks Bruce !

 Posted : Friday, June 15, 2018 5:56:11 AM
Registered User
Joined: 10/7/2004
Posts: 82

Bruce, what  about using  the technique you developed for the ttm squeeze?

Thinking out loud.

Bruce_L
 Posted : Friday, June 15, 2018 8:56:53 AM

Worden Trainer

Joined: 10/7/2004
Posts: 64,136

The TTM Squeeze technique is essentially the same as the Dots technique presented except that it uses the Histogram Plot Style instead of the Dots Plot Style.

The reason to use the Dots Plot Style in this case is that my assumption was that the moving average is being applied to something (such as price) that you would not want to cover up with a histogram.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

 Forum Jump Customer Training & Support - Ask a Trainer - TC2000 version 12/18 - Ask a Trainer - TC2000 version 7 - Ask a Trainer - StockFinder 5.0 - PCFs, EasyScan and Custom Indicators General Discussions - Stock and Market Talk - TC2000 version 12 or 18 - TC2000 version 7 - StockFinder 5.0 - RealCode for StockFinder 5.0 Tutorial Videos - TC2000 version 12 tutorial videos - TC2000 version 7 tutorial videos 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.