OK, so I tried to meld the newer Woodie's CCI w/ color histogram into the CCI strategy, but it wasn't quite obvious to me how to make that succeed.
Also, maybe its just me, but the strategy cci seems significantly different than the average cci. It seems like the strategy is more derived from a MA crossover than a true cci?
Also, maybe its just me, but the strategy cci seems significantly different than the average cci. It seems like the strategy is more derived from a MA crossover than a true cci?
var study = new CCIStudy(14, "HLC/3");
var study2 = new CCIStudy(6, "HLC/3");
function preMain() {
addBand(200, PS_DOT, 2, Color.black);
addBand(100, PS_SOLID, 2, Color.red);
addBand(0, PS_DASH, 2, Color.black);
addBand(-100, PS_SOLID, 2, Color.lime);
addBand(-200, PS_DOT, 2, Color.black);
setDefaultBarFgColor(Color.white, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.blue, 2);
setDefaultBarThickness(2,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(2,2);
setPlotType(PLOTTYPE_HISTOGRAM,2)
setCursorLabelName("Turbo",0);
setCursorLabelName("CCI",1);
setCursorLabelName("CCI",2);
setStudyTitle("Woodies CCI");
}
function main() {
var vCCI = study.getValue(CCIStudy.CCI);
var vTurbo = study2.getValue(CCIStudy.CCI);
if (study.getValue(CCIStudy.CCI) > study.getValue(CCIStudy.CCI,-1))
setBarFgColor(Color.lime,2);
if (study.getValue(CCIStudy.CCI) < study.getValue(CCIStudy.CCI,-1))
setBarFgColor(Color.red,2);
return new Array (vTurbo,vCCI,vCCI);
}
var study2 = new CCIStudy(6, "HLC/3");
function preMain() {
addBand(200, PS_DOT, 2, Color.black);
addBand(100, PS_SOLID, 2, Color.red);
addBand(0, PS_DASH, 2, Color.black);
addBand(-100, PS_SOLID, 2, Color.lime);
addBand(-200, PS_DOT, 2, Color.black);
setDefaultBarFgColor(Color.white, 0);
setDefaultBarFgColor(Color.black, 1);
setDefaultBarFgColor(Color.blue, 2);
setDefaultBarThickness(2,0);
setDefaultBarThickness(2,1);
setDefaultBarThickness(2,2);
setPlotType(PLOTTYPE_HISTOGRAM,2)
setCursorLabelName("Turbo",0);
setCursorLabelName("CCI",1);
setCursorLabelName("CCI",2);
setStudyTitle("Woodies CCI");
}
function main() {
var vCCI = study.getValue(CCIStudy.CCI);
var vTurbo = study2.getValue(CCIStudy.CCI);
if (study.getValue(CCIStudy.CCI) > study.getValue(CCIStudy.CCI,-1))
setBarFgColor(Color.lime,2);
if (study.getValue(CCIStudy.CCI) < study.getValue(CCIStudy.CCI,-1))
setBarFgColor(Color.red,2);
return new Array (vTurbo,vCCI,vCCI);
}
//CCI Averages Crossover Strategy
var study = new CCIStudy(10, "Close");
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI Strategy");
setCursorLabelName("CCI MA Slow",0);
setDefaultBarFgColor(Color.red,0);
setCursorLabelName("CCI MA FAST",1);
setDefaultBarFgColor(Color.blue,1);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
}
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);
}
var study = new CCIStudy(10, "Close");
function preMain() {
setPriceStudy(false);
setStudyTitle("CCI Strategy");
setCursorLabelName("CCI MA Slow",0);
setDefaultBarFgColor(Color.red,0);
setCursorLabelName("CCI MA FAST",1);
setDefaultBarFgColor(Color.blue,1);
setColorPriceBars(true);
setDefaultPriceBarColor(Color.grey);
}
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);
}
Comment