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);
|
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
|
Registered User Joined: 12/30/2004 Posts: 25
|
How do I use the Fib Fan in the Chart Tools?
Plant316
|
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
|