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

Fast & Slow CCI Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
yms1
Posted : Monday, April 29, 2013 9:44:14 PM
Registered User
Joined: 8/21/2010
Posts: 9

Hi Bruce I was looking to create this  Dual CCI setup... with Fast MA(21) & Slow MA(34) is it possible? I haven't a clue as to where to start with this.
This was from a previous platform I had and would like to have it here at TC2000.

function main(FastMA,SlowMA) {
	if (FastMA == null) 
		FastMA = 10;
	if (SlowMA == null) 
		SlowMA = 20;
	var vCCI;
	var i;
	var SlowSum = 0, FastSum = 0;
	
	vCCI = study.getValue(CCIStudy.CCI,0,-SlowMA);
	if(vCCI == null)
		return;
	for(i = 0; i < SlowMA; i++){
		if(i < FastMA)
			FastSum += vCCI[i];
		SlowSum += vCCI[i]
	}
	SMA = SlowSum / SlowMA;
	FMA = FastSum / FastMA;
	
	if(SMA < FMA && !Strategy.isLong())
		Strategy.doLong("Long", Strategy.MARKET, Strategy.THISBAR);
	if(SMA > FMA && !Strategy.isShort())
		Strategy.doShort("Short", Strategy.MARKET, Strategy.THISBAR);

	if(Strategy.isLong())
       		setPriceBarColor(Color.lime);
	if(Strategy.isShort())
        	setPriceBarColor(Color.red);

	return new Array(SMA,FMA);
Bruce_L
Posted : Tuesday, April 30, 2013 8:59:12 AM


Worden Trainer

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

I could be missing something as I don't fully understand the code, but this appear to just be plotting two moving averages on a CCI Indicator.

If, so you can just add a Commodity Channel Index (CCI) indicator to the chart and then add two moving averages indicators as well (the moving averages used in your code appear to be simple). Choose the CCI indicator when prompted for a parent when adding the moving averages.

Adding and Moving Indicators



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
plant316
Posted : Saturday, May 4, 2013 9:50:05 PM
Registered User
Joined: 12/30/2004
Posts: 25

How do I use the Fib Fan in the Chart Tools? 

 

Plant316

Bruce_L
Posted : Monday, May 6, 2013 10:13:22 AM


Worden Trainer

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

The trainers can't give setting, interpretation or investment advice. The way to draw a Fib Fan on the chart is to drag the pointer in such a way that you can connect the desired peak to trough or trough to peak on the chart. The following video explores drawing tools in general.

Drawing Tools in TC2000



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